delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/10/17/00:02:02

From: Austen DOT Jackson AT Rebus DOT Co DOT UK (Austen Jackson)
Subject: b19/NT4 - sockets - bind problem?
17 Oct 1998 00:02:02 -0700 :
Message-ID: <515E0908D677D111ACA340051170540125D3B8.cygnus.gnu-win32@SRV00001>
Mime-Version: 1.0
To: "'gnu-win32 AT cygnus DOT com'" <gnu-win32 AT cygnus DOT com>

Hi all,

Just tried a port of a server daemon, compile/link worked fine, but on
startup I get "Addresses in the specified family cannot be used with this
socket" - WSAEAFNOSUPPORT.

Sample snippet of code follows, offending line marked with a >>>:

	myaddress.sin_port=htons(port);
	v=socket(AF_INET,SOCK_STREAM,0);
	if(v==-1)
	{
		fprintf(stderr,"(%d)",errno);
		perror("INET: socket, ");
		exit(1);
	}
	setsockopt(v,SOL_SOCKET,SO_REUSEADDR,&tmp,sizeof(tmp));
>>>	while(bind(v,(struct sockaddr *)&myaddress,sizeof(myaddress))<0)
	{
		if(errno != EADDRINUSE)
		{
			close(v);
			fprintf(stderr,"(%d)",errno);
			perror("INET: bind, ");
			exit(1);
		}
		printf("Address in use: Retrying...\n");
		sleep(5);
	}

The combination of address family/socket type/protocol seems OK to me -
Anyone got any ideas?

Thanks,

Austen
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019