Re: send() was hold when sending message with Bolcking mode
From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 12/10/04
- Previous message: Pascal Bourguignon: "Re: how to tell if an open file has been removed"
- In reply to: Ethan Yu: "send() was hold when sending message with Bolcking mode"
- Next in thread: Ethan Yu: "Re: send() was hold when sending message with Bolcking mode"
- Reply: Ethan Yu: "Re: send() was hold when sending message with Bolcking mode"
- Reply: Ethan Yu: "Re: send() was hold when sending message with Bolcking mode"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 09 Dec 2004 19:30:54 -0500
In article <cp9oft$n0s$1@news.yaako.com>, "Ethan Yu" <ycy_76@163.net>
wrote:
> Hi,
>
> In my case, send() function is used for sending server message by client and
> the socket's mode is Blocking. When the server broke down, the client still
> sent message because it didn't know the server was down. After a while, the
> send() was hold and couldn't be recovered.
> When the socket uses blocking mode, how to recover the blocked send()?
You can use alarm() to send a signal if send() blocks for too long. Or
use select() to check whether the socket is writable.
-- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***
- Previous message: Pascal Bourguignon: "Re: how to tell if an open file has been removed"
- In reply to: Ethan Yu: "send() was hold when sending message with Bolcking mode"
- Next in thread: Ethan Yu: "Re: send() was hold when sending message with Bolcking mode"
- Reply: Ethan Yu: "Re: send() was hold when sending message with Bolcking mode"
- Reply: Ethan Yu: "Re: send() was hold when sending message with Bolcking mode"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|