Bridge Serial-Ports over network
https://stackoverflow.com/questions/29207980/bridge-serial-ports-over-network
For an application, which uses SerialPorts for communication (Modbus RTU, to be exactly) I need to bridge the SerialPort over the network for testing purposes.
So I would like to have the following Setup:
Device | Network | PC
SerialPort |------------------| SerialPort
Map Serialport| | Map network to Serialport
to Network | |
I already got the first part working with socat.
I opened the TCP Port on PC with
nc -l 8080
On my Device I used
socat pty,link=/dev/virtualcom0 tcp:PC-IP:8080
To map everything written on /dev/virtualcom0 to PC-IP on port 8080.
But now I have problems to map the socket back to a Serialport.
socat tcp:PC-IP:9123 pty,link=/dev/virtualport0
This got me a Connection Refused, which is obvious because i used TCP and the Port is already used by the Device.
So I tried the same with
socat pty,link=/dev/virtualcom0,raw udp:PC-IP:8080
and changed everything else to UDP, too.
But then nothing arrives on my /dev/virtlalcom0/ on my PC.
One side of the tcp connection needs to be listening on the port (the first one you launch), and the second side connects to it.
For the first side do:
socat tcp-listen:8080 pty,link=/dev/virtualport0
And for the second side do:
socat pty,link=/dev/virtualcom0 tcp:IP-of-other-machine:8080
Forget the netcat, you do not need it.
Bridge Serial-Ports over network的更多相关文章
- Using Virtual Serial Ports on Linux (Ubuntu)
http://www.xappsoftware.com/wordpress/2013/10/07/using-virtual-serial-ports-on-linux-ubuntu/?goback= ...
- libserialport: cross-platform library for accessing serial ports
/*********************************************************************************** * libserialport ...
- The network bridge on device VMnet0 is not running
The network bridge on device VMnet0 is not running. The virtual machine will not be able to communic ...
- Netruon 理解(12):使用 Linux bridge 将 Linux network namespace 连接外网
学习 Neutron 系列文章: (1)Neutron 所实现的虚拟化网络 (2)Neutron OpenvSwitch + VLAN 虚拟网络 (3)Neutron OpenvSwitch + GR ...
- Serial Port Programming using Win32 API(转载)
In this tutorial we will learn How to communicate with an external device like a microcontroller boa ...
- [转]Mac's and serial TTY's
Mac's are excellent tools for accessing serial device TTY ports (to console into PBX's, switches, an ...
- [转]Peer-to-Peer Communication Across Network Address Translators
Peer-to-Peer Communication Across Network Address Translators Bryan Ford Massachusetts Institute of ...
- OpenvSwitch代码分析之bridge和port
ovs-vsctl add-br br0 会在数据库里面加入新bridge的信息ovs-vsctl add-port br0 eth0 会在数据库里面加入新的port信息 void bridge_ru ...
- PatentTips - Method for network interface sharing among multiple virtual machines
BACKGROUND Many computing systems include a network interface card (NIC) to provide for communicatio ...
- Docker Network Configuration 高级网络配置
Network Configuration TL;DR When Docker starts, it creates a virtual interface named docker0 on the ...
随机推荐
- 基于WebSocket实现网页版聊天室
WebSocket ,HTML5 开始提供的一种在单个 TCP 连接上进行全双工通讯的协议,其使用简单,应用场景也广泛,不同开发语言都用种类繁多的实现,仅Java体系中,Tomcat,Jetty,Sp ...
- jQuery 插件开发指南
jQuery凭借其简洁的API,对DOM强大的操控性,易扩展性越来越受到web开发人员的喜爱,经常有人询问一些技巧,因此干脆写这么一篇文章给各位jQuery爱好者,算是抛砖引玉吧. 那么首先我们来简单 ...
- python3.4 百度API接口
# -*- coding: utf-8 -*- import urllib.request, json url = 'http://apis.baidu.com/netpopo/illegaladdr ...
- iOS开发之--字典快速赋值
以往在学习解析数据的时候,我们用的方法都是一个一个生命,然后加到字典里面,然后进行复制,那样的麻烦,而且也不能保证一次成功,不出错,我是遇到过多次key值的问题! 其实可以把复制的过程替换成一句话: ...
- shell脚本学习总结05--变量与环境变量
bash中一切变量都是以字符串的形式存储,env命令可以查看与此终端进程相关的环境变量. man bash 查看一个进程的环境变量 1.获得程序的PID,例如Java# pgrep java23492 ...
- IOS开发经验总结(二)
本文转载至 http://dreamahui.iteye.com/blog/1878922 IOS开发总结 by mhmwadm (感谢mhmwadm) 2013/4/10 1 XCode快捷键 4 ...
- IOS7开发~新UI学起(三)
1.UITextView: A ) IOS7新增加的 UITextViewDelegate 方法: - (BOOL)textView:(UITextView *)textView shoul ...
- 84、PullToRefresh使用详解
PullToRefresh使用详解(一)--构建下拉刷新的listView http://blog.csdn.net/harvic880925/article/details/17680305 Pul ...
- 第九课——MySQL优化之索引和执行计划
一.创建索引需要关注什么? 1.关注基数列唯一键的数量: 比如性别,该列只有男女之分,所以性别列基数是2: 2.关注选择性列唯一键与行数的比值,这个比值范围在0~1之前,值越小越好: 其实,选择性列唯 ...
- HDU3306—Another kind of Fibonacci
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3306 题目意思:一个斐波那契数列的变式,本来是A[n]=A[n-1]+A[n-2],现在变成A[n]= ...