IPAddress.Broadcast is a reference to the broadcast address statically
provided by the IPAddress class. It's in there for code readability. I've
also tried sending to IPAddress.Parse("255.255.255.255") with the same
result. As for binding to 0.0.0.0, I've tried that before as well: no luck.
> From your code it is not clear what is "IPAddress" for (IPAddress.Broadcast)
>
[quoted text clipped - 24 lines]
> > My question is, am I doing something wrong? Or is this expected (or even
> > desired) behavior? If so, any ideas how I could make it work correctly?
Arthur M. - 11 May 2005 20:12 GMT
There are two problems here,
I have not tried broadcasting through socket - hence theory here:
If binding to 0.0.0.0 does not work (I wonder what is the source then)
you have to open a socket per network card;
Also remember, that when you broadcast, you should broadcast to a local
network doing otherwies is bad networking.
Broadcasts wont always fall into x.x.x.255 scheme, you are looking at IP
Address + MASK combination; without going into a lecture
if I have a class C with address of 192.168.1.0, which i split into 29 bit
nets, I will get
192.168.1.0 / broadcast 192.168.1.7, 192.168.1.8 / broadcast 192.168.1.15
etc...
Just watch out for that, because broadcasting to 192.168.1.255 in that case
will deliver data to supernet if it is reachable:)
Thinking of that, it does make sense to use 2 different sockets, to make
sure each of your networks gets its own handling for broadcasted data.
> IPAddress.Broadcast is a reference to the broadcast address statically
> provided by the IPAddress class. It's in there for code readability. I've
[quoted text clipped - 29 lines]
> > > My question is, am I doing something wrong? Or is this expected (or even
> > > desired) behavior? If so, any ideas how I could make it work correctly?