discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sending UDP packets


From: Saso Kiselkov
Subject: Re: Sending UDP packets
Date: Thu, 26 Nov 2009 11:05:58 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It's better not to use 224.0.0.1 - that really is only for diagnostic
purposes. I recommend using something in the 239.0.0.0/8 range
(administratively scoped multicast), so that you can be relatively sure
you don't hit unrelated services on other machines.

- --
Saso

Andreas Höschler wrote:
> Hi Saso,
> 
>> Try replacing the "NSLog (@"sendto() failed");" with "perror ("sendto()
>> failed") - that will tell you exactly what went wrong. Also, as Lars
>> suggested, your application might be an ideal example of when to use IP
>> multicast (if you need, I can rewrite this code to work over multicast).
> 
> OK! I worked through the links Lars gave (Thanks Lars) and gathered the
> following information:
> *******************************************************************************************************************
> 
> Broadcast: Sending data to all possible destinations (an "all-hosts
> broadcast") permits the sender to send the data only once, and all
> receivers can copy it. In the IP protocol, 255.255.255.255 represents a
> limited local broadcast. In addition, a directed (limited) broadcast can
> be made by combining the network prefix with a host suffix composed
> entirely of binary 1s. For example, to send to all addresses within a
> network with the prefix 192.0.2, the directed broadcast IP address is
> 192.0.2.255 (assuming the netmask is 255.255.255.0).
> 
> Multicast : A multicast address is associated with a group of interested
> receivers. According to RFC 3171 , addresses 224.0.0.0 to
> 239.255.255.255 are designated as multicast addresses. This range was
> formerly called "Class D." The sender sends a single datagram (from the
> sender's unicast address) to the multicast address, and the intermediary
> routers take care of making copies and sending them to all receivers
> that have registered their interest in data from that sender.
> 
> 224.0.0.1   The All Hosts multicast group that contains all systems on
> the same network segment
> *******************************************************************************************************************
> 
> It is not clear to me why multicast is to be preferred in my case.
> However, I also have no idea yet how to modify my code snippets to use
> multicast. By the way, my broadcast code works fine even with
> 192.168.1.255 as broadcast address on GNUstep/Solaris. However, it does
> not work
> 
> Sending packet 9
> sendto() failed: Permission denied
> 
> on Cocoa/MacOSX! :-) And I need the code to work on both systems. For
> anyone interested to give it a try I have attached my test programs.
> 
> 
> 
> 
> Thanks,
> 
>   Andreas
> 
> 
> 
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAksOUwYACgkQRO8UcfzpOHC6FwCghPqgsUY9IxPNhLf4x2DmOxVQ
4hcAniChcz8SypwJuZBmSvOyb0L/eFwt
=Z5pw
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]