race condition in close socket??
Here's my problem.. Seems to only occur on localhost connections because they happen so fast.
(These are nonblocking sockets by the way)
1. I close a socket after its data transfer
2. Accept another incoming conneciton, it seems to get the same fd as the last socket closed.
3. Set the fd_set
4. Enter select loop which falls through
5. Sometimes though after trying to read or write to this new socket I get a Resouce Not Available.
I took out step 1 and everything seems to work fine.
Any possible idea of whats going on? I have an idea that file descriptor information is not immediately cleaned up. If so how can I prevent this?
|