• 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: UDP support for NSStream
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UDP support for NSStream


  • Subject: Re: UDP support for NSStream
  • From: Jens Alfke <email@hidden>
  • Date: Sun, 3 Aug 2008 11:42:02 -0700


On 3 Aug '08, at 10:45 AM, Liwei wrote:

Hmm, I can't seem to find information about how I may listen to and
make a broadcast over UDP. It seems that it needs to be connected in
some way first. How do I configure a connectionless UDP socket?

I've done this, but it was years ago and I don't have access to the source code anymore. :-(


IIRC, you create the CFSocket, using the right protocol constants for UDP, but don't connect it to a destination address. Then every time you want to send a packet, you call CFSocketSendData, with the 'address' parameter set to the address you want to send that packet to. You'll need to open another CFSocket for listening for incoming packets.

Do you mean "broadcast" literally? Instead of using UDP broadcast, which is deprecated, you should use multicast with an address in the link-local multicast range. (IIRC, the reason is that a UDP broadcast will be received by every single machine on the subnet, while a multicast can be ignored by machines that aren't listening on that particular multicast address.) Modern services like Bonjour use multicast.

—Jens

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: UDP support for NSStream
      • From: Liwei <email@hidden>
References: 
 >UDP support for NSStream (From: Liwei <email@hidden>)
 >Re: UDP support for NSStream (From: Jens Alfke <email@hidden>)
 >Re: UDP support for NSStream (From: Liwei <email@hidden>)

  • Prev by Date: Re: UDP support for NSStream
  • Next by Date: Jabber libraries suitable for Cocoa apps?
  • Previous by thread: Re: UDP support for NSStream
  • Next by thread: Re: UDP support for NSStream
  • Index(es):
    • Date
    • Thread