Re: recv() hangs (simple question?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try doing signal(SIGPIPE, SIG_IGN); somewhere in main().  recv() will just
return -1 and you can get the reason from errno.

Regards,

Aaron

On Mon, 29 Jul 2002, Frank Samuelson wrote:

>
> I have a client program that performs a recv()
> on a blocking socket.  The program catches SIGPIPEs and exits.
>
> When the server computer crashes the client hangs on the recv() call.
> It continues to do so even after the server computer comes back up.
> When the server computer shuts down nicely, or the
> server program is stopped or killed,
> this is not a problem.
>
> Is this standard behavior?  If yes, how to I
> hack it so the recv() call times out?
>
> Perhaps I should mention that this connection typically
> carries 6-7 MB/s on a 100Mb connection.  No
> data in >10 sec is an almost certain sign of a dead server.
>
> Thanks for any help
>
> -Frank
>
> -
> : send the line "unsubscribe linux-net" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux