How can i use multiple ethernet card for data transfer in my program( in C language)?

2002-11-06 Thread alireza mahini
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;i3,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 [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



How can i use multiple ethernet card for data transfer in my program( in C language)?

2002-11-03 Thread alireza mahini
I have 2 ethernet card {rl0 with inet 128.128.64.235
and rl1 with inet128.128.65.235).I wrote a program
that creates DGREAM sockets and bind them into valid
addresses then sending packets and receiving their
acks from another program.My code operates as below:
main(){
 sd1=socket(...);
 sd2=socket(...);
 rd1=socket(...);
 rd2=socket(...);
 bind(..sd1.);/*sd1 bind in 128.128.64.235 for sending
data*/
 bind(..sd2.);/*sd2 bind in 128.128.65.235 for sending
data*/
 bind(..rd1.);/*rd1 bind in 128.128.64.235 for
receiving data*/
 bind(..rd2.);/*rd2 bind in 128.128.65.235 for 
receiving data*/
 sendto(..sd1..);
 sendto(..sd2..);
 recvfrom(..rd1..);
 recvfrom(..rd2..);
...
}
As you see above i wanty send data from rl0 and rl1
but when i execute my code data only send from rl0 and
ther is not any data for outgoing from rl1.
please guide me what i must do? 

__
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



How can i use multiple ethernet card for data transfer?

2002-11-02 Thread alireza mahini
I have two ethernet interface that installed with
varient ips(rl0 , rl1) .I want send data from one
ofthem that i like but data sent to outside of my
computer from rl0.
I bind ip address of rl1 and use sendto function in my
program but data go out from rl0 to the remout
address.please guide me.
Thanks.

__
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



How can i use multiple ethernet card for data transfer?

2002-11-02 Thread alireza mahini
I have two ethernet card(lan card)in my system.
they have varient IPs.My OS(FreeBSD 4.4) known them as
rl0 ,rl1.
I want send data from the card that i like but data
only sent from rl0.
In my program i act as below:
...
 bind();//bind in rl1
 sendto();//send from a socket that bind at rl1  
...
but my packets are sent from the rl0. 
Note: I use DGRAM socket for my program.
please guide me for this problem. 

__
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



how can i use two child for sending and receiving data with minimum delay?

2002-11-02 Thread alireza mahini
Hello
I am Alireza .I develop a program for  sending  and
 receiving data via two child as below:
 main(){//parent
  if(!fork()){
   sendto(sd1,...);
   recvfrom(rd1,...);
   exit(0);
  }
  if(!fork()){
   sendto(sd2,...);
   recvfrom(rd2,...);
   exit(0);
  }
 while(waitpid(-1,NULL,WUNTRACED));//wait for childs
 
 } 
  In above solution time of waiting for childs is
about milisecond but when i wrote program without any
child (as below),program execution time is about
 microsecond.
 main(){
   sendto(sd1,...);
   recvfrom(rd1,...);
   exit(0);
   sendto(sd2,...);
   recvfrom(rd2,...);
  }
 Note :sd1,rd1,sd2,rd2 are DGRAM sockets;


__
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



How can i use the socket that created by a child in parent?

2002-10-15 Thread alireza mahini

I create a stream socket in a child process and i want
to use it outside of child.
main(){
int sd;
int fd[2];
char buf[20];
 pipe(fd));
 if(!fork()){
   sd=socket();
   ...
   ...
  write(fd[1]);//write sd to the pipe 
 }
read(fd[0],...)//read sd from pipe
send(sd,);//error is occured in this line at 
executing the program
...
}
I understand that the descriptors don't send via pipe
to the outside of childs so guide me please.
///Alireza 

__
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos  More
http://faith.yahoo.com

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Is there any way that i can listening ,accepting and handeling two or more sockets at the same time?

2002-10-10 Thread alireza mahini

I want to accepting and handeling(sending to and
receiving from) two sockets(STREAM socket)at the
same time please guide me and send me a sample code
written in c++ about this title for me.
Thanks for your attention.  
 

__
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos  More
http://faith.yahoo.com

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



What is the best IDE for C++programming in FreeBSD4.4?

2002-10-08 Thread alireza mahini

I am Alireza and i am a young c++ developer in
freebsd.
I am working with freebsd4.4 and i need an IDE for
programming in C or C++ languages such as KDvelop.
Please guide me about this .
[EMAIL PROTECTED] 

__
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos  More
http://faith.yahoo.com

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



How do i install the Kdevelop?

2002-10-08 Thread alireza mahini

I am downloading Kdevelop pakage from it's website
as a GZ file and I am extract it into my root
directory
but i don't know how to install and run it;

__
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos  More
http://faith.yahoo.com

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Which is the kdevelop version is compatible with ported kde in freebsd 4.4?

2002-10-08 Thread alireza mahini

 
 

__
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos  More
http://faith.yahoo.com

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



How i can force a stream socket to wait as limited time in accept() function?

2002-10-08 Thread alireza mahini

I am a C++ programmer and the platform that i develop
my project on it is FreeBSD4.4 .I am aplaying the
setsocketopt()function for seting the timeout into the
stream socket that blocked in accept() function but i
can't successful.

__
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos  More
http://faith.yahoo.com

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Is ther any debugger for c and c++ programs in freebsd4.4?

2002-10-08 Thread alireza mahini

 
 

__
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos  More
http://faith.yahoo.com

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message