tags:

views:

37

answers:

2

I'm having an occasional problem with select() timing out on me. I have it set for twenty seconds. The system will handle 100's of transactions correctly, but occasionally one fails with the selet timing out. It does about 1 transaction every few seconds, opening and closing the tcp conncetion with each transaction. I thought the server my app was connecting to might have to many connection attempts pending, but no 4226 events are showing up in the logs

One more point thing I noticed when using wireshark that I'm getting a SYN,RST in response to the SYN I am appearently sending. This only happens a few times over the first second or two, then I don't see any more activity in Wireshark

A: 

You may need to rebuild your timeout value each time you go into select. select apparently can modify this value:

From here:

 select() may update the timeout argument to indicate how much time was left. 

If it modifies it, and you reuse it for input back into select, you may not be getting the timeout you expect. This is a linux man page though, your mileage may very with Windows, especially as the man page states:

the glibc pselect() function does not modify its timeout argument; this is the behaviour required by POSIX.1-2001

Somewhat of a speculative answer, hopefully it's helpful. Maybe if you post some code we can confirm/deny this hypothesis.

Doug T.
A: 

As far as I understand you are missing errors on asynchronous connect. Take a look at this SO question.

Nikolai N Fetissov