Microsoft .Net 3.5 introduced a new way to do Async Socket operations the SocketAsyncEventArgs class. It was specifically designed for high performance application and over it works great. For the applications I have used it for it has significantly reduced latency for our operations.
But I do have one pet peeve about it. There is no way (that I have found) to timeout if a send operation is taking to long. The specific case I am running up against is that occasionally my data consumer will encounter an error where it will stop processing data out of the TCP buffer but not disconnect. The server keeps sending and everything looks normal on the server side until the TCP buffers fill up. Once that happens the next call to SendAsync will just end up in the abyss. The completed event of the SocketAsyncEventArgs will never be fired.
This ends up being a problem. I ended up having to add some monitoring logic on top of the socket sending to make sure I know when calls aren't returning. but this seems like something that should be handled by the framework. Hopefully this will get remedied soon.
Sunday, December 6, 2009
Subscribe to:
Posts (Atom)