A intractable socket bind problem.
A intractable socket bind problem.
- Subject: A intractable socket bind problem.
- From: "jacky.zhu" <email@hidden>
- Date: Mon, 14 Feb 2005 17:07:38 +0800
- Importance: Normal
Title: Message
hi all,
I met an intractable in socket
programing.The situation is, I have two processes to run in turn, one opens a
socket to listen connections and handles those requests,then it closes the
listening socket and notify the other process open another socket on
the same IP address and port to continue handling rest connections. The problem
is, though I have used the following pieces of code to let sockets could
bind to the same address and port:
int sockOpt =
TRUE;
ret = setsockopt( mListen, SOL_SOCKET, SO_REUSEADDR,
(char*)&sockOpt, sizeof(sockOpt) );
and the first process
has already closed its listening socket,
the second process
can't bind its socket to the address and port until about a minute later
.
It seems a minute or
longer time should be consumed to let the system free all handles occupied by
the first process even the first process has called close to free its listening
socket.
Can any kind
people help me resolve it? Any ideaes may be helpful.
Thanks,
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden