Access to Serial Port from Internet
server_rs232 <tcp_port> <serial_port>
- tcp_port. TCP port in which server listen to
- serial_port. COM1, COM2, etc (/dev/ttySX in Linux). Of course It can be also a virtual serial port<ref>A virtual serial port is a serial port that OS thinks is a real serial port, but it is instead controlled by an application. It can typically be used to emulate hardware, which normally is connected to a serial port.</ref>
>server_rs232 1234 COM1 Using serial port COM1 Waiting for a connection on port tcp/1234...
As a client we can use telnet or HyperTerminal
>telnet IP <port>
Serial port configuration is 9600bps, 1 stop bit, 8 data bits and without parity bit, also abbreviated as 9600/8N1. If you want to change this, you can easily modify the source code.
Access to several serial ports
In order to have access to several serial ports we can execute several instances of the server, each one using a different port. Because the server is very small (15K) this would not have to consume a lot of memory.
>server_rs232 2001 COM1 >server_rs232 2002 COM2 >server_rs232 2003 COM3 >server_rs232 2004 COM4 >...
The server does not offer any security mechanism, does not request user name/password nor encrypts data. If this is a problem then you can use SSH to encapsulate (SSH tunneling) the connection's data and to have an authentication mechanism. You need
- ssh client (here a ssh client for Windows) at the client machine
- ssh server in the server host, the one that has the shared serial port (here a ssh server for Windows)
ssh lets that a secure channel between two hosts be utilized by an external program. The tunnel starts at the client host
host-a, passes throught an intermediate host
host-x (access point to private network from Internet) and ends at final host
The command that does the job is
user@host-a:~$ ssh -f -N -L1234:host-b:5000 user@host-x Password:
From now, each program that connects to local host (
host-a) 1234 TCP port will be actually connecting to 5000 TCP port of
host-b. If there is not intermediate host
host-x is simply
user@host-a:~$ ssh -f -N -L1234:host-b:5000 user@host-b Password: [ssh process goes background and the prompt returns inmediately] user@host-a:~$ netcat localhost 1234 ...