Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Nov 2002 19:30:02 -0800 (PST)
From:      alireza mahini <alirezamahini@yahoo.com>
To:        questions@freebsd.org
Subject:   How can i use multiple ethernet card for data transfer in my program( in C language)?
Message-ID:  <20021107033002.47061.qmail@web40702.mail.yahoo.com>

next in thread | raw e-mail | index | archive | help
I have two ethernet card(NIC)im my computer .Their
characteristics are:

name:rl0
ip:128.128.64.235
netmask:255.255.0.0
broadcast:128.128.255.255

name:rl1
ip:128.128.65.235
netmask:255.255.0.0
broadcast:128.128.255.255

Both of them is up when i use ifconfig command.
I want develop a program that can use rl0 and rl1 for
data communication.My code is similar as flow:

main(){
...
 for(i=0;i<3,i++){
   sd[i]=socket(...);//create DGRAM sockets
   if (sd[i]==-1) return -1;
 }
 bind(sd[0],...);//bind sd0 to ip address of rl0
 bind(sd[1],...);//bind sd1 to ip address of rl0
 bind(sd[2],...);//bind sd2 to ip address of rl1
 bind(sd[3],...);//bind sd3 to ip address of rl1
 sendto(sd[0],...);//send form rl0 to remout host1
 sendto(sd[2],...);//send from rl1 to remout host2
 recvfrom(sd[1],...);//receive in rl0
 recvfrom(sd[3],...);//receive in rl1
return 1;
}
In the first time when i executed my program all data
sent form rl0 ,in other word packets of rl1 and
packets of rl0 were sent by rl0;
So i use the route command as flow:
#route add [remout host2]-interface rl1
 In this case data of rl1 weren't sent by rl0 but 
 rl1 didn't send data too.
please guide me .Thanks.  






__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021107033002.47061.qmail>