Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Oct 2002 10:17:50 -0700 (PDT)
From:      alireza mahini <alirezamahini@yahoo.com>
To:        questions@freebsd.org
Subject:   How can i use the socket that created by a child in parent?
Message-ID:  <20021015171750.59644.qmail@web40702.mail.yahoo.com>

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