Re: Programming for two separate Ethernet interfaces



To answer your questions, yes, you can enumerate adapters (GetAdaptersInfo).
You can also bind a socket, whether incoming or outgoing, to a given IP
address. You do that just like you would for a server TCP program, except
instead of INADDR_ANY, you'd pick the specific IP you want to be associated
with.

Paul T.

"Galgalat Sacharin" <Galgalat Sacharin@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:F2A2A187-8DAC-4D21-A495-B3FD743616C1@xxxxxxxxxxxxxxxx
I have an application where I access embedded measurement devices from a
CE-based controller using UDP/IP. No problems as long as I only have one
Ethernet interface in my CE machine. However, I now face a situation where
the measurement devices need to be grouped into two separate groups (I use
broadcasts, and it's not desirable that all units should be affected
simultaneously). Unfortunately the measurement devices are hardcoded to
use a
certain port number, and I don't have access to their firmware to modify
that
behavior. Otherwise I could just have used different port numbers to
communicate with different groups.
Now it seems my only option is to use two separate physical networks, but
I
don't know how to program that in my software. Can you enumerate the
available physical interfaces? When and how do you indicate which
interface
you wish to communicate over? I'd assume when you set up a socket or bind
to
it, but I can find no specific information about that in the API
documentation...
Any help would be appreciated.


.



Relevant Pages

  • 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)
  • BIND 9.5.2rc1 is now available.
    ... BIND 9.5.2rc1 is now available. ... triggering an assertion failure in ... API and glibc hides parts of the IPv6 Advanced Socket ... need to tweak ISC_SOCKET_MAXSOCKETS at compilation time ...
    (comp.protocols.dns.bind)