RE: Socket Broadcasting with Multiple Adapters
- From: Arthur M. <ArthurM@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 11 May 2005 11:22:03 -0700
>From your code it is not clear what is "IPAddress" for (IPAddress.Broadcast)
Try to make sure your socket is bound to 0.0.0.0 IP address
beyond that - it is wierd
"Ian Smith" wrote:
> I'm getting some weirdness when sending out broadcasts on a system with two
> adapters. The adapters are configured with IP addresses on seperate subnets.
> Packets get sent out on each interface, but the source addresses (as seen
> from a packet sniffer) on both packets is the IP address for adapter #1. This
> creates a problem when clients on adapter #2's network try to respond because
> they can't reach the source address on adapter #1's network.
>
> Here's some code that illustrates the problem:
> public static void Main(string[] args)
> {
> byte[] bytes = Encoding.UTF8.GetBytes("Testing broadcast...");
> IPEndPoint endpoint = new IPEndPoint(IPAddress.Broadcast, 10485);
> Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram,
> ProtocolType.Udp);
>
> socket.SetSocketOption(SocketOptionLevel.Socket,
> SocketOptionName.Broadcast, 1);
> socket.SendTo(bytes, endpoint);
> }
>
> 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?
.
- Follow-Ups:
- RE: Socket Broadcasting with Multiple Adapters
- From: Ian Smith
- RE: Socket Broadcasting with Multiple Adapters
- References:
- Socket Broadcasting with Multiple Adapters
- From: Ian Smith
- Socket Broadcasting with Multiple Adapters
- Prev by Date: Re: .net 2.0 beta DetailsView question
- Next by Date: RE: Installed v1.1 but VS still using v1.0
- Previous by thread: Socket Broadcasting with Multiple Adapters
- Next by thread: RE: Socket Broadcasting with Multiple Adapters
- Index(es):
Relevant Pages
|