Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Nov 2002 18:57:50 -0800 (PST)
From:      alireza mahini <alirezamahini@yahoo.com>
To:        questions@freebsd.org
Subject:   how can i use two child for sending and receiving data with minimum delay?
Message-ID:  <20021103025750.99272.qmail@web40707.mail.yahoo.com>

next in thread | raw e-mail | index | archive | help
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 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?20021103025750.99272.qmail>