Subject: Re: dumb bind() question..? (round 2)
To: None <netbsd-help@NetBSD.ORG>
From: Nigel Reed <Nigel.Reed@axp.cmpu.net>
List: netbsd-help
Date: 03/26/1998 00:25:52
I did manage to get this to work by making the binary static 

# cc testing.c -o testing
# ./testing
status: -1
stupid program:: Can't assign requested address
# rm testing
# cc testing.c -static -o testing
# ./testing

And I can't write a bit of a C code for the life of me, but I can compile it 
*grin*

Regards
Nigel

It appears that on 25 Mar 98 at 21:39, tooleym@douglas.bc.ca scribbled the 
following note:

> The appended program gives me the following:
> 
> bind
> status: -1
> stupid program:: Can't assign requested address
> 
> P.s. Yes I'm still 140.161.99.105. ;)
> P.P.S. See, the problem didn't originate with this program, it originated
> with a program which dealt with the return values correctly.
> 
> P.P.P.S. Any comments? :)
> 
> /** snip **/
> #include <sys/types.h>
> #include <netinet/in.h>
> #include <sys/socket.h>
> 
> main()
> {
> int s, status;
> struct sockaddr_in bindme;
> int len = sizeof(bindme);
> 
> if (s = socket(AF_INET, SOCK_STREAM, 0)) {
> 	bindme.sin_family = AF_INET;
> 	bindme.sin_port = htons(9000);
> 	bindme.sin_addr.s_addr = inet_addr("140.161.99.105");
> 	if ((status=bind(s, (struct sockaddr *)&bindme, sizeof(bindme))) != 0) {
> 		printf("status: %2d\n", status);
> 		if (status == -1) {
> 			perror("stupid program:");
> 		}
> 	}
> 	close(s);
> }
> }
> 
> /** snip **/
> 
> 
--
Nigel Reed
ICQ UIN: 2729612
http://kechara.flame.org/~nigel/britnet