select ethernet card for socket?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

how can i select an specific ethernet card for a
socket, when i have multiple ethernet-cards (lan,
wireless) installed?

i have two cards, configured for two different subnets:
   wireless: 192.168.50.x
   lan: 2.1.1.x
and want to open a socket and broadcast to 2.1.1.x but
without touching the wireless-settings. currently, i

my $sendsocket = new IO::Socket::INET(
       LocalHost => '',
       LocalPort => '6454',
       PeerAddr => '',
       PeerPort => '6454',
       Proto => 'udp',
       Broadcast => 1
    ) || die "[ERROR CREATING SOCKET] $!\n";
$sendsocket->sockopt(SO_BROADCAST, 1);

which causes the wireless-connection to collapse...
i guess i can do something with 'bind' but can't
figure out how to identify the correct card...

thanks a ton!

Re: select ethernet card for socket?

Susanne West wrote:
Quoted text here. Click to load it

Is your LAN really class A or should your broadcast address be

Try first to create a socket without the broadcast to see if that is
somehow causing havoc.

** Posted from **

Re: select ethernet card for socket?

smallpond wrote:
Quoted text here. Click to load it

for those reading along: i solved the problem which was falsly
identified on the perl level. instead there was another script
that added a gateway to the lan card in question. as soon as that
gateway was added, the binding sequence of the cards kicked in,
routing everything through that (wrong) first gateway into 2.1.1.x

in this case, setting up the cards with
  - ip
  - subnet
and a gateway for the wireless adapter was enough...

thanks anyhow smallpond.

Site Timeline