Stephen Montgomery-Smith wrote:
> listenfd=socket(AF_INET,SOCK_STREAM,0);
> bzero(&servaddr,sizeof(servaddr));
> servaddr.sin_family=AF_INET;
> servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
> servaddr.sin_port=htons(3000);
> if (bind(listenfd,(struct sockaddr*)&servaddr,sizeof(servaddr)) < 0)
You probably need to set the SO_REUSEADDR socket option; Stevens talks
about this eventually, maybe you haven't read that far. Basically you
need something like
int foo = 1;
and then call
setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &foo, sizeof foo);
between the socket() and listen() calls. Check setsockopt(2) and
Stevens for more information (and to make sure I got the arguments and
stuff right!)
--
Ben Smithurst / [EMAIL PROTECTED] FreeBSD: The Power To Serve
http://www.FreeBSD.org/
PGP signature