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? |
did you do a "shutdown()" on the socket before closing it ?
|
yes I do actually. as I stated I believe it to be some sort of race condition because remote connections never produce the race condition it seems. I can also put in a small sleep after the close and everything seems to work. This shouldn't happen though I think.
|
So you use close(), shutdown() (which direction?) or both?
|
All times are GMT -5. The time now is 02:46 PM. |