c - Redirect STDIN to socket and socket to STDOUT -
I am trying to develop a simple command line client on the server. After connecting to the server and setting up everything properly, I want to redirect the The easiest solution will be selected Thank you. On linux you can move data between file descriptor at the kernel level by STDIN to the server and the same socket on the
STDOUT I want to get the same behavior as the
nc device.
() and
to read () /
to write () From
STDIN to the data socket and pass
STDOUT from the socket. Does Socket anyway
STDIN /
STDOUT? Any other easy way to add to is
dup2 () I thought about using the system call though, I'm not sure how it works.
splice ( 2) . However, you have to use
(2) (or equivalent) to handle two directions in parallel, or optionally use two threads.
Comments
Post a Comment