[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: UDP Broadcast
- From: Sam Roberts <vieuxtech@...>
- Date: Thu, 12 Nov 2009 17:01:04 -0800
On Thu, Nov 12, 2009 at 1:17 PM, Doug Rogers
> Clark Snowdall wrote:
> Also, for me udp:setpeername() fails under Linux when I use 'localhost'
> in setsockname(). I have to set the host variable to be the local IP
> address on the Ethernet interface (to which I want to send). I'm not
> sure why this is so - perhaps use INADDR_ANY rather than 'localhost'?
localhost isn't mapped to 127.0.0.1 automatically, it happens because
localhost is in /etc/hosts:
% grep localhost /etc/hosts
::1 ip6-localhost ip6-loopback
Also, some DNS server setups map it that way.
> If these are not your problems, then I'm at a loss. I was able to
> capture the subnet broadcast packet using Wireshark; it's Ethernet
> address was broadcast. I set the filter to 'udp port 47808' and made the
> mods mentioned above.
Clark, is it possible the subnet mask is not 255.255.255.0, as your
bcast address assumes?
ifconfig will tell you the bcast address, mine says this:
eth0 Link encap:Ethernet HWaddr 00:16:17:75:D4:DA
inet addr:192.168.41.177 Bcast:192.168.41.255 Mask:255.255.255.0
By default, the netmask for the 10.* IP addresses is 8, so your bcast
addr would be 10.255.255.255, but its probably set to something else.