• 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: CFSocketSetRemoteAddress, UDP sockets, and error handling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFSocketSetRemoteAddress, UDP sockets, and error handling


  • Subject: Re: CFSocketSetRemoteAddress, UDP sockets, and error handling
  • From: Andrew White <email@hidden>
  • Date: Fri, 11 Feb 2005 12:44:42 +1100


Douglas,

Douglas Davidson wrote:
To test, I tried various combinations of sending packets. As long as I don't send to a port that doesn't exist, it works fine. Once I do so, that socket never works properly again. What gives?


Any thoughts?


Please file a bug report and we will check it out. It would be helpful if you could include a small self-contained project or source file that demonstrates this. You could also send that directly to me and I will take a look at it.

Thanks for your reply.

Turns out the problem is an "expected" behaviour of UDP sockets. If you 'connect' a UDP socket and then send, but the destination port is not available, the target host will send back an ICMP error message. This in turn becomes EISCONN, an asynchronous error condition on the socket. At this point, the socket is unusable and must be closed.

Due to the vaguaries of UDP sockets, this condition occurs on a connected UDP socket (with send) but not an unconnected socket (with sendto). And because UDP is connectionless, only manifests when (after) a packet is sent, rather than at connect time as TCP does.

Stevens "Unix Network Programming" (2nd ed) discusses most of this on pp 220-221.

What makes this "feature" harder to diagnose is that CFSocket doesn't seem to return any of this error information. Am I missing a way to get more informative error codes than "succeed" / "fail" / "timeout"?

--
Andrew White

--------------------------------------------------------------------------
This email and any attachments are confidential. They may contain legally
privileged information or copyright material. You should not read, copy,
use or disclose them without authorisation. If you are not an intended
recipient, please contact us at once by return email and then delete both
messages. We do not accept liability in connection with computer virus,
data corruption, delay, interruption, unauthorised access or unauthorised
amendment. This notice should not be removed.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: CFSocketSetRemoteAddress, UDP sockets, and error handling (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: Translate into ObjectiveC
  • Next by Date: Re: Fade out the window content
  • Previous by thread: Re: CFSocketSetRemoteAddress, UDP sockets, and error handling
  • Next by thread: Re: Cocoa-dev Digest, Vol 2, Issue 190
  • Index(es):
    • Date
    • Thread