Coder Social home page Coder Social logo

serialport-server's Introduction

serialport-server

Simple Utility to Expose a local serial port on a network port, allowing for remote serial port access

Published on Dockerhub @ https://dockerhub.com/akshmakov/serialport-server

Requirements

  • socat

Usage

Start a server simply by

$ ./serialport-server.sh /dev/ttyUSB0

Full Usage Information:

Usage: serialport-server.sh [OPTIONS] device

options:
     -p/--port=<PORT>         : exposed TCP Port (default=2000)
     -b/--tty-br=<BAUDRATE>   : baud rate of underlying device (default=9600)
     -l/--logfile=<FNAME>     : save output to file
     -h/--help                : print this usage
     -d/--daemon              : daemonize (background)
     -v/--verbose             : more (debug)

device: local socket or device (e.g. /dev/ttyUSB0)

The following Environment Variables can be used in lieu of args
PORT     - TCP Port
BAUDRATE - Baudrate
DEVICE   - device

Usage - Docker

Docker container is available under dockerhub akshmakov/serialport-server:TAG, list of tags

  • latest amd64 container for standard x86_64 systems (alpine base)
  • arm32v7 armv7 systems (RPI 2/3)
  • arm32v6 armv6 systems (RPI 1 , comaptible with 2/3)
  • arm32v6-x.x.x, arm32v7-x.x.x, amd64-x.x.x Frozen Version Tags (These Tags will not be overwritten on DockerHub)

If you leave the tag off, the amd64 tag will be pulled

To start a dockerized serial port server on host port '2000'

$ docker run -d -p "2000:2000" --device "/dev/ttyUSB0:/dev/ttyUSB0" akshmakov/serialport-server:latest /dev/ttyUSB0
# test your server
$ nc 127.0.0.1 2000

Usage - docker-compose

Start two serialport-servers using either command or environment variables

version: '2'
services:
  tty1:
    image: akshmakov/serialport-server
    devices:
      - "/dev/ttyUSB0:/dev/ttyUSB0"
    command: -b 19200 /dev/ttyUSB0
    ports:
      - "2000"
  tty2:
    image: akshmakov/serialport-server
    devices:
      - "/dev/ttyUSB1:/dev/ttyUSB1"
    environment:
      BAUDRATE:19200
      DEVICE:/dev/ttyUSB1

Client

Connect to a serialport server using a number of common terminals that accept a network socket.

Simplest use case is netcat, note that many terminal commands lik C-c will not work

$ nc ip.of.serial.server 2000

using socom to provide a true tty (accepts ctrl-c

$ socom file:'tty',raw,echo=0 tcp:ip.op.serial.server:2000,raw,echo=0

using picocom or minicom pointing them at the port

On windows, this server has been tested with realterm

serialport-server's People

Contributors

akshmakov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

serialport-server's Issues

Closes on EOF

need to add ignoreeof option to socat invocation otherwise server will close and need restart for commands that terminate with EOF (like echo)

$ echo "ls" | nc 127.0.0.1 2000

Cannot stream to multiple endpoints

Hello,

I started this container, connected to the streamer from another computer on my network, and it streams fine.

Then i get on another computer, and try to connect to the streamer and it either starts streaming data and the other computer looses connection, or it refuses to connect at all. Is it possible to make this a one-to-many (bidirectional) capable streamer?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.