I'm trying to write some application code which will communicate via a TCP connection to a device. I have complete control of my application (which runs on a server to which I have SSH access) and no control of the device. At the moment my comms code is not working and I want to debug it at a binary level.
For sake of argument, let's say the server connects to port 10000 on the device.
I want to (a) listen on port 10000 on my desktop, (b) configure the server to think the device is my desktop, (c) forward any data I get on port 10000 to port 10000 on the device, and send any replies back whilst (d) logging everything going to/from the device.
Any suggestions as to how I might do this? Or some suitable terminology to Google for?
My desktop is Ubuntu and I have the luxury of a GUI there if I need it. The application is a Modbus/TCP driver for an industrial unit if anyone is interested. The protocol is simple, but binary.