Hello,
I am trying to understand how to communicate with a test equipment I have, which features an ethernet port and has two open network ports:
Port 80: can be accessed with a browser and will allow remote control of the test equipment
Port 20: this is the port I am trying to connect to, because I know that it will allow me to play with manufacturer settings (calibration date, options, etc.).
I have the list of possible commands, but i am not able to setup a connection.
I made a small test program in VB.net. It allows me to send the commands from my list and they are accepted, because... nothing happens. If I send a wrong command, the screen will show an error message stating the wrong command I just sent. So i can send data to th eequipment.
To send commands I just open a simple connection to the device IP on port 20.
The problem is that i don't get anything back!
So I used Wireshark to see what is happening and in fact, i do get responses like these:
7 0.460145 192.168.1.161 192.168.1.2 TCP 60 20 → 55080 [FIN, ACK] Seq=1 Ack=7 Win=5834 Len=0
So basically, the device is sending a packet from its port 20 to a random port (in this case 55080) to my PC's IP. This port number changes on every message I send to the device.
I think this is what "asynchronous communication" is all about and the purpose is to simultaneously allow different clients to the same server. The FTP protocol does that, too.
What I don't know is: how to I know inside my VB.Net program, which port the device is sending the response to?
Also, I think this is part of a three way handshake, as the above example has Len=0 and does not contain the expected reply. If I send "*IDN", which is a valid command, I would expect to receive a string with the device name and serial number. So what do I need to send back?
Any idea on this?
I already tried telnet and here the communication is closed after each byte sent. Using SSH does not work, either, the connection process will cause an error message to appear on the device, as the ssh protocol starts by sending unsupported commands.
I think the protocol is the simplest possible:
PC --> Device on Port 20
Device replies on random port, i.e. 56789 --> PC
PC --> acknowledges on port 56789 --> Device
Device --> sends requested data to port 56789 --> PC
Again, the question is: how do I know what port to listen to?
I think I am just missing some direction on how to implement basic TCP networking (I have little knowledge on that).
Any help is much appreciated!
Regards,
Vitor