Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Selects eth device to send/receive

Reply
Thread Tools

Selects eth device to send/receive

 
 
SungHyun Nam
Guest
Posts: n/a
 
      08-20-2007
Hello,

If there are two ethernet device, how I can select a device to send/receive?

Actually I want to do loopback test between twe ethernet device.
Send a UDP packet through eth0 and receives that packet from eth1 device.
And vice versa.

Regards,
namsh
 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      08-20-2007
SungHyun Nam wrote:
> Hello,
>
> If there are two ethernet device, how I can select a device to send/receive?
>

Asking on a platform specific group would be a good start.

--
Ian Collins.
 
Reply With Quote
 
 
 
 
Ivan Gotovchits
Guest
Posts: n/a
 
      08-20-2007
Ian Collins wrote:

> SungHyun Nam wrote:
>> Hello,
>>
>> If there are two ethernet device, how I can select a device to
>> send/receive?
>>

> Asking on a platform specific group would be a good start.
>

If there're two diferent NICs, then they will have different IP's (if you\re
talking about TCP/IP).
So, when receive you need to specify the NIC address, not the INADDR_ANY,
anf to send you must specify address of the desired NIC.

 
Reply With Quote
 
Walter Roberson
Guest
Posts: n/a
 
      08-20-2007
In article <fab0uo$m50$>,
SungHyun Nam <> wrote:

>If there are two ethernet device, how I can select a device to send/receive?


Ethernet and network communications are not part of the C language;
they are OS-dependant extensions. The appropriate technique can depend
upon the OS and OS version, and it can further depend upon which
networking libraries you link into the executable.

What you ask to do isn't possible for a user-level program in
some OS's; in particular, some OS's insist on choosing the
output communications device based upon the destination address.

[OT]
In some Unix-like operating systems that allow choice, the mechanism is
to bind() the socket to a source IP associated with the communications
device you wish to emit from. But if you want to find out
whether that will work on -your- OS, you will need to read the
documentation. Which will probably be extremely vague on the matter,
expecting that you have read one of the several excellent networking
textbooks.
--
There are some ideas so wrong that only a very intelligent person
could believe in them. -- George Orwell
 
Reply With Quote
 
Walter Roberson
Guest
Posts: n/a
 
      08-20-2007
In article <fab6nm$1qn$>,
Ivan Gotovchits <, > wrote:
>Ian Collins wrote:


>> SungHyun Nam wrote:


>>> If there are two ethernet device, how I can select a device to
>>> send/receive?


>> Asking on a platform specific group would be a good start.


>If there're two diferent NICs, then they will have different IP's (if you\re
>talking about TCP/IP).


No, that's merely how it happens on the systems you've encountered.
IP addresses need not be associated with particular NICs -- and
*aren't*, once you get into high-reliability systems which have to
keep going smoothly even when individual NICs fail (or their
network link goes down.)
--
Is there any thing whereof it may be said, See, this is new? It hath
been already of old time, which was before us. -- Ecclesiastes
 
Reply With Quote
 
Ivan Gotovchits
Guest
Posts: n/a
 
      08-20-2007
Walter Roberson wrote:

> In article <fab6nm$1qn$>,
> Ivan Gotovchits <, > wrote:
>>Ian Collins wrote:

>
>>> SungHyun Nam wrote:

>
>>>> If there are two ethernet device, how I can select a device to
>>>> send/receive?

>
>>> Asking on a platform specific group would be a good start.

>
>>If there're two diferent NICs, then they will have different IP's (if
>>you\re talking about TCP/IP).

>
> No, that's merely how it happens on the systems you've encountered.
> IP addresses need not be associated with particular NICs -- and
> *aren't*, once you get into high-reliability systems which have to
> keep going smoothly even when individual NICs fail (or their
> network link goes down.)

So, can you specify what stack do you use? Because it is really
stack-dependent question, or even platform dependend if it is not POSIX
stack.
Or you can use multicast or broadcast addresses and send messages containing
some magic numbers defining the NIC that sends it. So you can verify that
all transmissions was ok.
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      08-20-2007
Ivan Gotovchits wrote:
> Ian Collins wrote:
>> SungHyun Nam wrote:
>>>
>>> If there are two ethernet device, how I can select a device to
>>> send/receive?
>>>

>> Asking on a platform specific group would be a good start.

>
> If there're two diferent NICs, then they will have different IP's
> (if you\re talking about TCP/IP). So, when receive you need to
> specify the NIC address, not the INADDR_ANY, anf to send you must
> specify address of the desired NIC.


Please don't even attempt to answer OT queries on c.l.c. The
experts to correct mistakes are not present here. Limit your
response to advice on what newsgroups to ask on.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>



--
Posted via a free Usenet account from http://www.teranews.com

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determine the IP address of an eth interface billie Python 3 01-19-2006 09:43 AM
eth line protocol problem Andrew Cisco 0 11-17-2005 01:07 PM
Connecting to a PIX firewall using cisco VPM client though a Linksys WAG54G with eth firewall enabled Phil Cisco 1 12-11-2004 12:30 PM
NuB: Authenticate everything on Eth thru Radius??? Targa Cisco 0 10-28-2004 08:51 PM
cisco lost ping on eth Korn Cisco 0 08-15-2004 10:49 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57