0

I have a setup in which one unix program (s51 from a microcontroller simulation package) is a server tied to a specific port. Let's call the port 111.

I also have setup a client on the same computer to receive hexadecimal characters as output from the server as follows:

nc 127.0.0.1 111 | od -tx1 -w16

Now I want to be able to send data back out to the same port without disconnecting anything else from the port.

I tried:

 echo "data" | nc 127.0.0.1 111

and that command just stalls and nothing is sent to the server.

Unfortunately the only IP based option I have with the server is to specify the port number. The IP format is fixed to TCP/IP by the server.

How do I go about reusing the same port and sending data back to the server all in unix without breaking the connection?

So far the closest answer I have to my problem is to get a second computer, Run realterm on it for windows and have it connect to the main computer running the simulator in linux over TCP/IP.

I tried Wine, but realterm inside wine freezes too often.

I tried Telnet but the best it can do with displaying hex is everything down one column, but I'm wanting 30 columns of hex data.

What can I do to solve my problem all in a unix environment without wasting power of a second computer and without having to upgrade any system?

  • 1
    You can type straight into the existing nc and it will send those characters on the network connection. If you want to type in hex and have that translated to binary for transmission (as asked in stackoverflow.com/questions/55073784/… ) then you can pipe your input into nc through xxd -r -p, per my answer to that question. – ottomeister Mar 10 at 1:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.