• 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: getpeername()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getpeername()


  • Subject: Re: getpeername()
  • From: Cryx <email@hidden>
  • Date: Sat, 18 May 2002 01:11:04 -0500

On Tuesday, May 14, 2002, at 06:04 PM, email@hidden wrote:

is there a bug in mac os x's getpeername()?

i have a socket connected to a server... the client is reading asynchronously in the runloop...

when i kill the server, the read returns with 0 bytes, errno is EAGAIN, and if i do a getpeername() which was suggested as a way to test to see if the remote side was gone, it doesn't return -1!!!

anyone else run into this? how do you detect when your server has disconnected from you?

Unless you put the socket into non-blocking more, a read of length 0 is the indication that the connection with the remote host has been lost. I believe the getpeername() test was bad advice.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >getpeername() (From: email@hidden)

  • Prev by Date: Re: NSTextField overwrites itself
  • Next by Date: odd release
  • Previous by thread: getpeername()
  • Next by thread: setFrameAutosaveName: gone insane
  • Index(es):
    • Date
    • Thread