• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Posted read() hangs on socket disconnect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Posted read() hangs on socket disconnect


  • Subject: Re: Posted read() hangs on socket disconnect
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 27 May 2009 16:46:22 -0700


On May 27, 2009, at 4:32 PM, Jonathon Kuo wrote:

The receiving process uses a read() posted on a socket that reads small data packets in a loop. It works fine until the sender quits (disconnects/aborts). I was expecting the posted read() call to return with a status < 0, but it never returns, it just hangs forever.

If the sending process closes the socket, exits or crashes, then the socket will be closed on the receiving end too. I would think the read call would return immediately, with errno==ECONNRESET, but I'm somewhat sketchy on the low-level POSIX network APIs.


On the other hand, if the sending machine is abruptly disconnected (Ethernet unplugged, power failure, kernel panic...) then the receiver never gets notified that the connection's closed, and so it will end up waiting for a very long time, like 90 minutes, before giving up and deciding the socket's closed.

—Jens [Ricketts Hovse '87]

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Posted read() hangs on socket disconnect
      • From: Jonathon Kuo <email@hidden>
References: 
 >Posted read() hangs on socket disconnect (From: Jonathon Kuo <email@hidden>)

  • Prev by Date: Posted read() hangs on socket disconnect
  • Next by Date: Re: Posted read() hangs on socket disconnect
  • Previous by thread: Posted read() hangs on socket disconnect
  • Next by thread: Re: Posted read() hangs on socket disconnect
  • Index(es):
    • Date
    • Thread