I have a client that connects to a server on localhost:10000. The server is not in the same host. But we can not access to the server from IP network. For this we are writing our own network driver that will create a virtual network interface. Then 10000 on that server will be available.
For now, we are trying write an application that just mimics the server behavior. It should listen to localhost:10000 and writes any incoming data to a named pipe. Also write any incoming data on named pipe to the connected clients. I believe this can be done very easily using a simple tool called netcat or nc. How do I do that?
I have this fifo named fifo. I execute
nc -l 4444 > ../fifo
This command only writes any data found on incoming connection to the fifo. How do I make it two way? meaning it should both read from and write into the pipe?
This can be done using two FIFOs. Suppose they are
inandout.You run your netcat server as
How this work
nc -l 4444listens to local4444port for any incoming connection. When connected it sends any thing found oninpipe to the client and writes anything from the client tooutfifo.