Bind Problem - with multihomed



Hi,

I have a multihomed pc with Windows XP Pro SP2 installed and two network
interfaces. My task is to build an application to send out data from a
particular interface.

What I did is, first I created two datagram sockets and then, I used the
bind() function to bind each socket with the interface. Then I used the
sendto() function to send out some data over the interface. The problem is
that when I am using a sniffer to watch the outgoing packets, both packets
seems to be leaving from the same interface with the source IP changed.

The funny thing is that the same code works fine when I run it on a Windows
XP Pro without the SP2 installed.

Is it correct to use the bind function to bind a socket to a particular
interface or there is another API function?


Many Thanks.

--------------

bind (Windows Socket)

"This allows the underlying service provider to use any appropriate network
address, potentially simplifying application programming in the presence of
multihomed hosts" ... msdn quote.


-------------




.



Relevant Pages

  • Re: Programming for two separate Ethernet interfaces
    ... To answer your questions, yes, you can enumerate adapters. ... You can also bind a socket, whether incoming or outgoing, to a given IP ... Ethernet interface in my CE machine. ...
    (microsoft.public.windowsce.app.development)
  • Re: UDP question.
    ... >> My two adapters has two different IP address, and I bind one IP ... >> do you mean that I alloc two socket and bind different IP is not ... > sending a packet *to* 1.2.4.5, it will go out the first interface. ... not real bind the adapter? ...
    (Linux-Kernel)
  • Re: UDP question.
    ... > do you mean that I alloc two socket and bind different IP is not ... it will go out the first interface. ... not real bind the adapter? ...
    (Linux-Kernel)
  • Source IP / INADDR_ANY
    ... To connect libmysql.c calls socket() and then connect, ... bind() inbetween. ... automatically bound to a random free port with the local address set ... "interface numbering" is secretly rotated. ...
    (comp.os.linux.networking)
  • Re: Networks and wireless etc
    ... When bind() assigns an interface that contradicts the routing table the ... "For a sending host, if the source address is specified by the sending ...
    (microsoft.public.win32.programmer.networks)