addr.sin_port=htons(net->l_port);
addr.sin_addr.s_addr=INADDR_ANY;
- /* prevent addres in use error message */
- true=1;
- if(setsockopt(net->l_fd,SOL_SOCKET,SO_REUSEADDR,&true,sizeof(true))==-1) {
- perror("[network] setsockopt call");
- return N_ERROR;
- }
-
if(bind(net->l_fd,(struct sockaddr *)&addr,
sizeof(struct sockaddr))==-1) {
- perror("[network] bind call");
- return N_ERROR;
+ /* try harder ... */
+ true=1;
+ if(setsockopt(net->l_fd,SOL_SOCKET,SO_REUSEADDR,&true,sizeof(true))==-1) {
+ perror("[network] setsockopt call");
+ return N_ERROR;
+ }
+ puts("[network] reused address");
}
if(listen(net->l_fd,MAX_LISTEN_QUEUE)==-1) {