Re: How do I get my own IP address?

new topic     » goto parent     » topic index » view thread      » older message » newer message
useless said...

Eight computers, each with onboard 10/100 lan and one pci 10/100/1000 lan card. The 100lan goes to a 24port 100switch which also goes to the rest of the house and the internet. The 1000lan pci cards go to a 1000lan switch. This way, the 8 can talk amongst themselves really fast and i don't need to buy a 24port 100/1000 for the entire house. And i can use different filter rules in each switch. So how to tell Eu code which nic to use, based on that code's purpose?

I believe the answer is to use socket:bind, even though it's listed as 'server only.' I say this based upon:

http://stackoverflow.com/questions/428313/a-machine-has-2-nics-which-will-be-utilized-when-connecting-to-a-socket

Excerpted from the accepted answer (the one with a check mark):

j_random_hacker said...

So how can a client choose what NIC to use? A client can also choose to call bind() if it so desires, after socket() and before connect(). Usually this isn't done simply because connect() will automatically bind an unbound socket in a way that enables access via any NIC (which is usually the desired behaviour), but this auto-binding can be turned off by calling bind() explicitly. In this case, you should specify 0 for the port number to have the OS choose a random port number for you.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu