Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pavelrevak/ser2tcp
serial to tcp or telnet server, ser2net python alternative
https://github.com/pavelrevak/ser2tcp
network python serial tcp telnet
Last synced: about 20 hours ago
JSON representation
serial to tcp or telnet server, ser2net python alternative
- Host: GitHub
- URL: https://github.com/pavelrevak/ser2tcp
- Owner: pavelrevak
- License: mit
- Created: 2016-06-26T12:47:15.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-06-26T15:30:33.000Z (over 2 years ago)
- Last Synced: 2023-08-02T18:12:41.912Z (over 1 year ago)
- Topics: network, python, serial, tcp, telnet
- Language: Python
- Size: 37.1 KB
- Stars: 39
- Watchers: 4
- Forks: 14
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ser2tcp
Simple proxy for connecting over TCP or telnet to serial port## Version
**ser2tcp v3.0** https://github.com/pavelrevak/ser2tcp## Features
- can serve multiple serial ports using pyserial library
- each serial port can have multiple servers
- server can use TCP or TELNET protocol
- TCP protocol just bridge whole RAW serial stream to TCP
- TELNET protocol will send every character immediately and not wait for ENTER, it is useful to use standard `telnet` as serial terminal
- servers accepts multiple connections at one time
- each connected client can sent to serial port
- serial port send received data to all connected clients## Instalation
```
pip3 install .
```### Uninstal
```
pip3 uninstall ser2tcp
```## command line options
```
-h, --help show this help message and exit
-V, --version show program's version number and exit
-v, --verbose Increase verbosity
-c CONFIG, --config CONFIG
configuration in json format
```### Verbose
- By default print only ERROR and WARNING messages
- `-v`: will print INFO messages
- `-vv`: print also DEBUG messages## Configuration file example
```json
[
{
"serial": {
"port": "/dev/tty.usbserial-01BB6216",
"baudrate": 115200,
"parity": "NONE",
"stopbits": "ONE"
},
"servers": [
{
"address": "127.0.0.1",
"port": 10001,
"protocol": "TCP"
},
{
"address": "0.0.0.0",
"port": 10002,
"protocol": "TELNET"
}
]
},
{
"serial": {
"port": "/dev/tty.usbserial-A6005CNx",
"baudrate": 115200,
"parity": "NONE",
"stopbits": "ONE"
},
"servers": [
{
"address": "0.0.0.0",
"port": 10011,
"protocol": "TCP"
},
{
"address": "192.168.1.123",
"port": 10012,
"protocol": "TELNET"
}
]
}
]
```
`serial` structure pass all parameters to [serial.Serial](https://pythonhosted.org/pyserial/pyserial_api.html#classes) constructor from pyserial library,
this allow full control of the serial port## Usage examples
For installed version:
```
ser2tcp -c ser2tcp.conf
```
Direct running from repository:
```
python3 run.py -c ser2tcp.conf
```### Connecting using telnet
```
telnet 0 10012
```
(to exit telnet press `CTRL + ]` and type `quit`)## Installation as server
### Linux - systemd local user service
1. edit configuration file `~/.config/ser2tcp.conf`
1. reload user systemd services:
```
systemctl --user daemon-reload
```
1. start service:
```
systemctl --user start ser2tcp
```
1. auto-start service:
```
systemctl --user enable ser2tcp
```
1. to allow user services running after boot you need to enable linger as root (if this is not configured, then service will start after user login and stop after logout):
```
sudo loginctl enable-linger $USER
```#### Other useful commands
* check if service is running:
```
systemctl --user status ser2tcp
```
* stop service:
```
systemctl --user stop ser2tcp
```
* stop restart:
```
systemctl --user restart ser2tcp
```
* see logs from service:
```
journalctl --user-unit ser2tcp -e
```
## Requirements
- python v3.5+
- pyserial v3.0+### Running on:
- Linux
- MacOS
- Windows## Credits
(c) 2016-2021 by Pavel Revak### Support
- Basic support is free over GitHub issues.
- Professional support is available over email: [Pavel Revak](mailto:[email protected]?subject=[GitHub]%20ser2tcp).