Re: UDP support for NSStream
Re: UDP support for NSStream
- Subject: Re: UDP support for NSStream
- From: Mark Pauley <email@hidden>
- Date: Mon, 4 Aug 2008 14:05:37 -0700
You get to choose the multicast address from the following criterion:
http://www.iana.org/assignments/multicast-addresses
If you're doing this on a LAN you don't own, make sure to ask your
network admin first!
On Aug 3, 2008, at 4:45 PM, Liwei wrote:
Well, both will work really since its not some big network I have, but
multicast will be better.
So what do I use as the destination address? The multicast address
(like 255.255.0.0)? Would that work?
2008/8/3 Jens Alfke <email@hidden>:
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
_______________________________________________
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
_Mark
email@hidden
_______________________________________________
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