alevine
November 9th, 2006, 03:56 PM
I tried this question on the C# programming forum board a month or so ago with no luck. I figured I give it a shot on this board since is general network related...
I have an embedded server and a C# Client GUI that connects to it via Tcp. Normally the Client initiates closing the connection and all is fine. In some circumstances the server may wish to initiate closing the connection. In this case the server sends the FIN and is ack'd by the client. However the Client (C# GUI) does not follow up with the closing the second half of the pipe. I do not see any events/callbacks I can hook into at the application to detect the server half of the close so the client can follow-up with it's close. Talking to colleagues it seems that they encountered the problem and test the socket by doing a write of 0 bytes and catching the exception (or likewise a read). This seems like a less than optimal solution. Does any one know how to detect the server initiating the close so the aplication can be informed.
It appears that clients are generally expected to close connections not servers. However in general TCP/IP does not speficy such a requirement.
i.e. see:
Internetworking with TCP/IP fourth edition Douglas Comer Figure13.14 Page 240 :)
I have an embedded server and a C# Client GUI that connects to it via Tcp. Normally the Client initiates closing the connection and all is fine. In some circumstances the server may wish to initiate closing the connection. In this case the server sends the FIN and is ack'd by the client. However the Client (C# GUI) does not follow up with the closing the second half of the pipe. I do not see any events/callbacks I can hook into at the application to detect the server half of the close so the client can follow-up with it's close. Talking to colleagues it seems that they encountered the problem and test the socket by doing a write of 0 bytes and catching the exception (or likewise a read). This seems like a less than optimal solution. Does any one know how to detect the server initiating the close so the aplication can be informed.
It appears that clients are generally expected to close connections not servers. However in general TCP/IP does not speficy such a requirement.
i.e. see:
Internetworking with TCP/IP fourth edition Douglas Comer Figure13.14 Page 240 :)