N
nix
Hi ,
I have a query with read call for reading the socket data. From defn
it is read(socket_fd, buffer, BUFSIZE)
Now if I don't know the BUFSIZE? I want to read whenever the data
comes and write this data to a different socket.
My scenario is
I have a socket connection established between two programs (p1 and p2
assuming) running in separate systems. The data which I get on p1 from
p2 will be redirected to a different socket on p1's box and similarly
data coming on p2 from p1 will be redirected to a different socket on
p2's box.
My first question
The size of data is not fixed and I don't know how much I have to
read. How do I handle this in read call?
For redirecting, I guess I have to use write() to write the data
which I have got from read() to a different socket. For writing I can
give write(sock_id,request,strlen(request)); Is this the right way?
thanks
I have a query with read call for reading the socket data. From defn
it is read(socket_fd, buffer, BUFSIZE)
Now if I don't know the BUFSIZE? I want to read whenever the data
comes and write this data to a different socket.
My scenario is
I have a socket connection established between two programs (p1 and p2
assuming) running in separate systems. The data which I get on p1 from
p2 will be redirected to a different socket on p1's box and similarly
data coming on p2 from p1 will be redirected to a different socket on
p2's box.
My first question
The size of data is not fixed and I don't know how much I have to
read. How do I handle this in read call?
For redirecting, I guess I have to use write() to write the data
which I have got from read() to a different socket. For writing I can
give write(sock_id,request,strlen(request)); Is this the right way?
thanks