文档章节

Serial2Ethernet Bi-redirection

zungyiu
 zungyiu
发布于 07/21 23:05
字数 972
阅读 9
收藏 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

© 著作权归作者所有

共有 人打赏支持
zungyiu
粉丝 11
博文 144
码字总数 34440
作品 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 andfixes issues related to server redirection for Window......

oschina
2014/05/22
3K
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

没有更多内容

加载失败,请刷新页面

加载更多

下一页

vue+element-ui操作删除(单行和批量删除)

页面展示: <template><!-- 表格内容 --><el-table :data="packData" border style="width: 100%" ref="multipleTable" @selection-change="handleSelectionChange"><el-tab......

琴妹
15分钟前
0
0
基于vue(element ui) + ssm + shiro 的权限框架

zhcc 基于vue(element ui) + ssm + shiro 的权限框架 引言 心声 现在的Java世界,各种资源很丰富,不得不说,从分布式,服务化,orm,再到前端控制,权限等等玲琅满目,网上有句话说,语言框架...

DarrenHu_吴邪
22分钟前
2
1
数据库水平切分(MyCat分片)

范围分片 io.mycat.route.function.AutoPartitionByLong 自动范围分片 Function名称:rang-long(配置文件默认) 枚举分片 io.mycat.route.function.PartitionByFileMap 枚举分片 Funtion名称...

这很耳东先生
23分钟前
0
0
读《HeadFirst设计模式》笔记之外观模式

外观模式:提供了一个统一的接口,用来访问子系统中的一群接口。外观定义了一个高层接口,让子系统更容易使用。 举个栗子: 建了一个家庭影院,但是每次享受家庭影院时,你发现需要执行 将灯...

suyain
24分钟前
0
0
MongoDB分片配置

简单注解: mongos 路由进程, 应用程序接入mongos再查询到具体分片,监听端口默认27017 config server 路由表服务, 每一台都具有全部chunk的路由信息 shard为数据存储分片, 每一片都可以是...

LUIS1983
32分钟前
0
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部