文档章节

Serial2Ethernet Bi-redirection

zungyiu
 zungyiu
发布于 07/21 23:05
字数 972
阅读 29
收藏 0

Serial Tool is a utility for developing serial communications, custom protocols or device testing. You can set up bytes to send accordingly to your protocol and save configuration to a file – which can be used another time.
You can send multiple byte arrays, you can send sequence of different byte arrays and put delay between them. You can read data in HEX or ASCII. You can even write a note to yourself like: “CH1: toggle LED 1”. GitHub

tcp2com creates a bridge between a TCP socket and a serial port (COM). The program runs as a service under Windows NT. With tcp2com, you can telnet into any device you may have plugged into your COM port.

A very simple software that bidirectionally forwards COM (serial) communication through a TCP/IP connection.

 

ScriptCommunicator is a scriptable cross-platform data terminal which supports serial port (RS232, USB to serial), UDP, TCP client/server, SPI, I2C and CAN.

ScriptCommunicator (scriptable data terminal) script which routes:
- serial port (RS232, USB to serial) <-> TCP/IP (Client/Server)
- serial port (RS232, USB to serial) <-> UDP/IP
- TCP/IP (Client/Server) <-> UDP/IP

Serial port sniffer, network serial server/client and serial port emulator Serial port sniffer, network serial server/client and serial port emulator

You can achieve this with standard tools using socat and tee.

1) socat -d -d pty,raw,echo=0 pty,raw,echo=0. The output will give you two ports ...N PTY is /dev/pts/27... N PTY is /dev/pts/28.

2) sudo cat /dev/ttyS0 | tee /dev/pts/27 and in another terminal sudo cat /deb/pts/27 | tee /dev/ttyS0. Finally

3) Connect your program to /dev/tty/28.

The two tee commands will dump both directions to the console and forward to/from the actual serial port. Note that the port settings like baudrate must be configured ahead of time. – jtpereyda Jul 18 '15 at 0:36
You can save the tee stuff to a file, too: cat /dev/pts/27 | sudo tee /dev/ttyS0 serial-caps and xxd will help if it's a binary protocol: cat /dev/pts/27 | sudo tee /dev/ttyS0 serial-caps | xxd

There are a few options:

sersniff is a simple program to tunnel/sniff between 2 serial ports.

Serial line sniffer (slsnif) is a serial port logging utility. It listens to the specified serial port and logs all data going through this port in both directions.

Serial to Network Proxy (ser2net) provides a way for a user to connect from a network connection to a serial port. For more: here

SerialSpy acts as a serial pass-through device. It listens for incoming data on two serial ports and forwards it so the devices act as if they are directly connected. It also logs the data as it moves through the ports.

sercd is an RFC 2217-compliant serial port redirector. It lets you share a serial port through a network. It is based on sredird. The RFC2217 protocol is an extension to telnet and allows changing communication port parameters.

SerLooK is a KDE application for inspecting data going over serial lines. It can work as a binary terminal that sends and receives data through a defined port (Point to Point mode) and displays them on separate views. Each view can be configured to display data in hexadecimal, decimal, octal, binary, and raw ASCII. It is also possible to perform I/O through terminal emulation views and define a secondary port and monitor the traffic between two external hosts using a "Y" cable (Snooper mode).

nullmodem creates a virtual network of pseudo-terminals. It can be used as an adapter to connect two programs that normally need serial interface cards.

ttywatch monitors, logs, and multiplexes terminal I/O. It has full log rotation built in, and can use telnet as well as local TTY ports.

  • Linux sreen command

screen -L /dev/ttySx > logging file

Example for remote tty (tty over TCP) using socat

#### Method xx

You don't need to write a program to do this in Linux. Just pipe the serial port through netcat:

netcat www.example.com port </dev/ttyS0 >/dev/ttyS0

Just replace the address and port information. Also, you may be using a different serial port (i.e. change the /dev/ttyS0 part). You can use the stty or setserial commands to change the parameters of the serial port (baud rate, parity, stop bits, etc.).

 

 

####Method 1

All the tools you would need are already available to you on most modern distributions of Linux.

As several have pointed out you can pipe the serial data through netcat. However you would need to relaunch a new instance each time there is a connection. In order to have this persist between connections you can create a xinetd service using the following configuration:

service testservice
{
    port        = 5900
    socket_type = stream
    protocol    = tcp
    wait        = yes
    user        = root
    server      = /usr/bin/netcat
    server_args = "-l 5900 < /dev/ttyS0"
}

Be sure to change the /dev/ttyS0 to match the serial device you are attempting to interface with.

https://stackoverflow.com/questions/484740/converting-serial-port-data-to-tcp-ip-in-a-linux-environment

####Method 2

Open a port in your server with netcat and start listening:

nc -lvp port number

And on the machine you are reading the serial port, send it with netcat as root:

nc <IP address> portnumber < /dev/ttyACM0

If you want to store the data on the server you can redirect the data to a text file.

First create a file where you are saving the data:

touch data.txt

And then start saving data

nc -lvp port number > data.txt

© 著作权归作者所有

共有 人打赏支持
上一篇: IO Redirection
zungyiu
粉丝 11
博文 156
码字总数 35677
作品 0
深圳
私信 提问
Bonita 开放解决方案 5.6.2 发布

这是 Bonita 5.6 分支的最新维护版本,下载地址:here. 该版本修复了如下一些 bug: - 0005807: [console-appli] Filenames with "&" don't work. - 0008137: [studio-connectors] Groovy ......

DongZhang
2012/02/23
1K
1
Ubuntu远程桌面客户端连接WINDOWS

rdesktop 是一个在 Unix/Linux 下访问 Windows 远程桌面的客户端程序。当前,rdesktop 所支持的 Windows 系列版本包括 NT、2000、XP 和 2003。通过使用 rdesktop 所实现的远程桌面协议(RDP...

张旭0512
2014/05/21
0
2
rdesktop 1.8.2 发布,远程桌面客户端

rdesktop 1.8.2 发布,此版本更新内容如下: add support for server redirection when connecting to a Windows 2012 RDS Farm and fixes issues related to server redirection for Windo......

oschina
2014/05/22
3.2K
14
丢弃的输出(Discard the output)(过滤的输出)

Sometimes you will need to execute a command, but you don't want the output displayed to the screen. In such cases you can discard the output by redirecting it to the file /dev/......

肖鋭
2014/06/01
0
0
WordPress实现301重定向(跳转)的5种方法

站长们都知道301对SEO的意义,特别是首页有的站长喜欢将带www的地址直接跳转到不带www的域名地址,而又有的站长则喜欢网站地址都带上www。在网站建设过程中,可能由于前期规划不到位,或者后...

English0523
2015/09/10
0
0

没有更多内容

加载失败,请刷新页面

加载更多

EOS docker开发环境

使用eos docker镜像是部署本地EOS开发环境的最轻松愉快的方法。使用官方提供的eos docker镜像,你可以快速建立一个eos开发环境,可以迅速启动开发节点和钱包服务器、创建账户、编写智能合约....

汇智网教程
今天
10
0
《唐史原来超有趣》的读后感优秀范文3700字

《唐史原来超有趣》的读后感优秀范文3700字: 作者:花若离。我今天分享的内容《唐史原来超有趣》这本书的读后感,我将这本书看了一遍之后就束之高阁了,不过里面的内容一直在在脑海中回放,...

原创小博客
今天
17
0
IC-CAD Methodology知识图谱

CAD (Computer Aided Design),计算机辅助设计,指利用计算机及其图形设备帮助设计人员进行设计工作,这个定义同样可以用来近似描述IC公司CAD工程师这个岗位的工作。 早期IC公司的CAD岗位最初...

李艳青1987
今天
17
0
CompletableFuture get方法一直阻塞或抛出TimeoutException

问题描述 最近刚刚上线的服务突然抛出大量的TimeoutException,查询后发现是使用了CompletableFuture,并且在执行future.get(5, TimeUnit.SECONDS);时抛出了TimeoutException异常,导致接口响...

xiaolyuh
今天
8
0
dubbo 搭建与使用

官网:http://dubbo.apache.org/en-us/ 一,安装监控中心(可以不安装) admin管理控制台,monitor监控中心 下载 bubbo ops 这个是新版的,需要node.js环境,我没有就用老版的了...

小兵胖胖
今天
16
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部