• 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: Problem in leopard regarding socket shutdown
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem in leopard regarding socket shutdown


  • Subject: Re: Problem in leopard regarding socket shutdown
  • From: Adi Masputra <email@hidden>
  • Date: Sat, 29 Dec 2007 11:16:54 -0800


On Dec 29, 2007, at 10:17 AM, Rob Newberry wrote:

(I don't know what happens if you call "sendto" on a connected UDP socket using an address other than the one you didn't connect to -- I would expect an error.)

Specifying any address via sendto on a connected udp socket should result in EISCONN.


Consequently, I could IMAGINE "shutdown" on a UDP meaning, "undo the 'connect' call" -- the restoring your ability to use sendto/recvfrom to all addresses. But I would not be at all surprised to find this is not the case.

shutdown(2) is different than disconnecting a connected udp socket via connect(2) + AF_UNSPEC. The former simply sets the "can't send/recv" state of the socket, while the latter takes the PCB out of the bound state.

That document indicates that for UDP sockets, its perfectly valid to call "connect" again on a UDP socket (to "disconnect" and then "connect" with a different peer), and indeed recommends using that "connect" scheme with an AF_UNSPEC address to return the socket to an unconnected state. That seems like it might be Linux-specific, but I don't know.

I think it's a POSIX standard that connecting with an all zero address structure should cause such a behavior for DGRAM sockets. (AF_UNSPEC happens to be 0 in BSD-derived implementations; it's an artifact that got documented in various places, e.g. Stevens.)

Adi


Rob

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

References: 
 >Problem in leopard regarding socket shutdown (From: parag vibhute <email@hidden>)
 >Re: Problem in leopard regarding socket shutdown (From: parag vibhute <email@hidden>)
 >Re: Problem in leopard regarding socket shutdown (From: "Justin C. Walker" <email@hidden>)
 >Re: Problem in leopard regarding socket shutdown (From: Rob Newberry <email@hidden>)
 >Re: Problem in leopard regarding socket shutdown (From: "Justin C. Walker" <email@hidden>)
 >Re: Problem in leopard regarding socket shutdown (From: "parag vibhute" <email@hidden>)
 >Re: Problem in leopard regarding socket shutdown (From: Josh Graessley <email@hidden>)
 >Re: Problem in leopard regarding socket shutdown (From: Rob Newberry <email@hidden>)

  • Prev by Date: Re: Problem in leopard regarding socket shutdown
  • Next by Date: Re: Problem in leopard regarding socket shutdown
  • Previous by thread: Re: Problem in leopard regarding socket shutdown
  • Next by thread: Re: Problem in leopard regarding socket shutdown
  • Index(es):
    • Date
    • Thread