Re: Bind Problem - with multihomed



[...]

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 bind(...) function associates socket with local address. So it seems for
me it behaves correctly: the source IP is changed.

--
V.
This posting is provided "AS IS" with no warranties, and confers no
rights.
"Albert" <Albert@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A796CC0E-C02A-41BC-8204-A5BB473148C6@xxxxxxxxxxxxxxxx
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: UDP question.
    ... >> bind socket2 network adapter2 ... > I am not really sure, but I think the bind to an adapter under linux only ... To explicitly send things through a specific interface, ... all the packet sent from two socket is go out by one ...
    (Linux-Kernel)