How to know when to close socket when dealing with HTTP clients?

Posted by Y_Y on Stack Overflow See other posts from Stack Overflow or by Y_Y
Published on 2010-04-16T02:04:32Z Indexed on 2010/04/16 2:13 UTC
Read the original article Hit count: 268

Filed under:
|
|

Hi,

How can I know when to close the socket of an HTTP client (I mean a browser is connecting to my TCP socket server). Everything works perfect but in other for the browser to show what the server has sent, i have to shutdown the server (or call socket.Close()).

It works fine if I call (socket.Close()) but I just don't know when.? I don't want to call close in a middle of a request otherwise the browser would have to reload to connect to the server again.

© Stack Overflow or respective owner

Related posts about c#

Related posts about Windows