[ee122] Persistant Connections
Daniel Killebrew
dank at eecs.berkeley.edu
Wed Oct 31 15:40:07 PDT 2007
You could call recv() with the non-blocking and msg_peek flags to see if
the socket is open without blocking or removing any data from the recv()
buffer.
Daniel
Haley Nguyen wrote:
> On the client side, the socket is blocking, so the recv on the client
> side is blocking. Therefore, if recv return 0, it means that the other
> side close the connection. This is where I get the answer:
> http://mkssoftware.com/docs/man3/recv.3.asp.
>
> On 10/31/07, *Ofer Sadgat* <ofer at berkeley.edu
> <mailto:ofer at berkeley.edu>> wrote:
>
> If you have a connection to a server which you send a request and
> request a persistent connection but the server refuses. In its
> response it includes a Content-Length header. As the client I
> parse this and receive content-length data. However, Once I have
> received the data I continue on with no more calls to read.
> However, the server now closes the connection and the client has
> no idea of this event. The client then makes a request to the same
> server and noticing that that is where it last connected it
> doesn't establish a new connection. The following recv call fails.
>
>
>
> How do I fix this? Is there a way to check whether or not a server
> has closed the connection without receiving data?
>
>
>
> Thanks,
>
> Ofer
>
>
> _______________________________________________
> ee122 mailing list
> ee122 at mailman.ICSI.Berkeley.EDU
> <mailto:ee122 at mailman.ICSI.Berkeley.EDU>
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/ee122
>
>
>
>
> --
> Haley Nguyen
> ------------------------------------------------------------------------
>
> _______________________________________________
> ee122 mailing list
> ee122 at mailman.ICSI.Berkeley.EDU
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/ee122
>
More information about the ee122
mailing list