Subject: Re: dumb bind() question..? (round 2)
To: None <netbsd-help@NetBSD.ORG>
From: None <tooleym@douglas.bc.ca>
List: netbsd-help
Date: 03/25/1998 21:39:30
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 **/