RE: Socket Broadcasting with Multiple Adapters

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



>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?
.



Relevant Pages

  • Re: Getting started with a wlan driver
    ... The approach of treating an 802.11 adapter hardware as a non-network device is the solution for developing active network diagnostic tools on the Windows platform. ... the miniport driver can only receive packets based on ...
    (microsoft.public.development.device.drivers)
  • Re: How to know if a network adapter is connected
    ... This is the only way I know to identify the network adapter, ... Yes i agree but if the adapter is not connected to the network, the bind() function return SOCKET_ERROR. ... So i need to bind every socket each time i call the recv ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: unable to ping gateway
    ... AIX location code that I am using the right adapter. ... disabled or you have the wrong AIX ethernet port. ... Max Packets on S/W Transmit Queue: ...
    (comp.unix.aix)
  • Re: ZoneAlarm log shows probes *from* 127.0.0.1 ?
    ... packets are actually coming in on your internet adapter or not. ... vulnerability tests yourself on the specific version or try to find ...
    (comp.security.firewalls)
  • Re: tcpip adapter configuration question on an Aix 4.3.3 server
    ... Did you put an IP address on the new interface on the same network as your ... actually did then was probably to send all packets to the unattached adapter. ...
    (AIX-L)