Re: recv() hang
Tech-Archive recommends: Fix windows errors by optimizing your registry
- From: "Dave Lowther" <davel@xxxxxxxxx>
- Date: Fri, 1 May 2009 13:58:31 +0100
"naveen gupta" <gupta.naveen16@xxxxxxxxx> wrote in message
news:96bb6fb1-fe7b-4d87-a905-9b0e08e7e193@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i have server and client application running on different system.
server is just sending data and client is receiving. when server side
app's network disconnected(not client side N/W down) then client app's
recv() hang waiting for data(recv() is blocking fun and i dont want it
to be non-blocking) so my app hang. can anyone tell me how to come out
from blocking recv()
If you know you should receive some data at least every x seconds, then you
could set a receive timeout of 2x seconds perhaps. Or you could have some
other thread monitoring activity in your recv() thread and close the socket
if you see nothing happening.
Dave.
.
Relevant Pages
- Re: Messages being received out of order
... sure how much your data will be send in one packet, because if IP header is ... Are you saying that tcp assures you that if you send data1, ... then I only need to fix my client - specifically the recv handling? ... (microsoft.public.win32.programmer.networks) - Re: sending structure client server
... This is the basic algorithm for a client app, ... On a blocking socket, recv() will return when /any/ bytes are available, ... that's what's always done with stream sockets. ... (comp.unix.programmer) - Re: Segmented Data Over Sockets
... Just as others explained, if you sendN bytes from the client, it does not ... mean that a single corresponding recv() on the server will receive N bytes. ... each byte of the local structure on the receiving end, ... (microsoft.public.win32.programmer.networks) - Re: Incomplete lines received by a socket
... >> be returned by a single recvcall in the client. ... This is usually done by performing the recv() in a loop until ... in Unix (and most modern operating systems) you ... laying around, watching tv, and then the phone rings. ... (comp.unix.programmer) - Re: Receive binary file through recv
... I am trying to send a binary file from the client to the server. ... | the parameter ptr in recv() to the file descriptor of the newly ... a file descriptor because all that is really passed to the function ... (comp.unix.programmer) |
|