• 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: BSD Sockets read() resource temporarily unavailable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BSD Sockets read() resource temporarily unavailable


  • Subject: Re: BSD Sockets read() resource temporarily unavailable
  • From: Andreas Fink <email@hidden>
  • Date: Fri, 28 Oct 2016 00:39:06 +0200

Jeremy,

Are you running in a multi threaded environment?

bsd socket calls return the number of read or written bytes or -1 in case of error and if that happens errno is set.
And errno is different if your app is mutlithreaded or not as every thread needs its own errno. So historically it was a int but now its a macro to get it from the thread specific memory so your thread gets your "private" thread errno.

When you set the socket to non blocking or blocking yourself, then it stays in this mode until you change it. However certain things can occur while you sit in a wait call (poll/ select etc) which can make the call return early (EAGAIN for example) which means you have to be prepared for this and maybe have a loop to wait until you have enough data. Also in the case of TCP, your data might be chunked up in the middle. You can never assume one line is sent as a whole, it can arrive in pieces.

I dont think anything has really changed between 10.8 to 10.12 in this area.



Andreas Fink
------------------------------------------------------------------
Author of ulib networking library

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
  • Prev by Date: Re: iOS NETunnelProviderRoutingMethod question
  • Next by Date: Re: BSD Sockets read() resource temporarily unavailable
  • Previous by thread: Re: iOS NETunnelProviderRoutingMethod question
  • Next by thread: Re: BSD Sockets read() resource temporarily unavailable
  • Index(es):
    • Date
    • Thread