View Single Post
Old Aug 22nd, 2004, 5:00 AM   #1
tinah_pro
Newbie
 
Join Date: Aug 2004
Posts: 2
Rep Power: 0 tinah_pro is on a distinguished road
I'm programming a remote shell using the protocol UDP.
Therefore a server (server_udp.c) to listen one port number, and a client (client_udp.c) which send the command to the server, get the result of command and display it in the client screen.

The communication is already work but the my problem concerns the redirection of the standard output (1) in a file descriptor:
// server_udp.c

if(dup2(fd,1)<0){
perror("Error dup2"); exit(1);
}
if(read(fd,buf_response,1024)<0) {
perror("Error dup2"); exit(1);
}
puts(buf_response);

And it displays nothing. The string "buf_response" is empty.
I think that you'd understand and can help me.
Thanks
tinah_pro is offline   Reply With Quote