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的更多相关文章

  1. Using Virtual Serial Ports on Linux (Ubuntu)

    http://www.xappsoftware.com/wordpress/2013/10/07/using-virtual-serial-ports-on-linux-ubuntu/?goback= ...

  2. libserialport: cross-platform library for accessing serial ports

    /*********************************************************************************** * libserialport ...

  3. 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 ...

  4. Netruon 理解(12):使用 Linux bridge 将 Linux network namespace 连接外网

    学习 Neutron 系列文章: (1)Neutron 所实现的虚拟化网络 (2)Neutron OpenvSwitch + VLAN 虚拟网络 (3)Neutron OpenvSwitch + GR ...

  5. Serial Port Programming using Win32 API(转载)

    In this tutorial we will learn How to communicate with an external device like a microcontroller boa ...

  6. [转]Mac's and serial TTY's

    Mac's are excellent tools for accessing serial device TTY ports (to console into PBX's, switches, an ...

  7. [转]Peer-to-Peer Communication Across Network Address Translators

    Peer-to-Peer Communication Across Network Address Translators Bryan Ford Massachusetts Institute of ...

  8. OpenvSwitch代码分析之bridge和port

    ovs-vsctl add-br br0 会在数据库里面加入新bridge的信息ovs-vsctl add-port br0 eth0 会在数据库里面加入新的port信息 void bridge_ru ...

  9. PatentTips - Method for network interface sharing among multiple virtual machines

    BACKGROUND Many computing systems include a network interface card (NIC) to provide for communicatio ...

  10. Docker Network Configuration 高级网络配置

    Network Configuration TL;DR When Docker starts, it creates a virtual interface named docker0 on the ...

随机推荐

  1. Windows下基于eclipse的Spark应用开发环境搭建

    原创文章,转载请注明: 转载自www.cnblogs.com/tovin/p/3822985.html 一.软件下载 maven下载安装 :http://10.100.209.243/share/so ...

  2. 【Python】用文本打印树

    From:http://zhidao.baidu.com/link?url=O8U5TynGBMojDw2iFhlghPPf5_ZE1X8CAQMrK19pv-KxhvKCc6Z2yzsoQaukgN ...

  3. windows CMD命令大全及详细解释和语法

    http://blog.csdn.net/god_7z1/article/details/51173067

  4. python入门(七):CGI编程

    CGI CGI(Common Gateway Interface),通用网关接口,HTTP服务器与你的或其它机器上的程序进行“交谈”的一种工具,其程序须运行在网络服务器上. CGI在其中扮演的是在we ...

  5. MVC框架图

    http://www.cnblogs.com/zgynhqf/archive/2010/11/19/1881449.html   MVC框架图 http://www.cnblogs.com/zhang ...

  6. Android无线测试之—UiAutomator UiScrollable API介绍五

    滑动区域校准常量设置与获取 一.校准概念 校准常量指的是:滑动操作坐标时的偏移量,用来取偏移比例 二.相关API 返回值 API 描述 double getSwipeDeadZonePercentag ...

  7. Win32控制台中使用定时器的方法

    在MFC中用OnTimer()函数就可以很方便的实现定时事件,但在Win32控制台工程中没有消息循环,MSDN里也不推荐把SetTimer()用在Console Applications里. 同理,在 ...

  8. JavaScript匿名函数的使用

    JavaScript匿名函数的使用:  http://www.cnblogs.com/skykang/archive/2010/12/03/1895274.html 一.什么是匿名函数? 在Javas ...

  9. SpringMvc三大组件详解

    SpringMvc框架结构图 处理器映射器:用户请求路径到Controller方法的映射 处理器适配器:根据handler(controlelr类)的开发方式(注解开发/其他开发) 方式的不同区寻找不 ...

  10. powerdesinger导出数据库说明文档

    设置表结构要展示的属性,以及各个属性的展示列宽 不显示标题 右键单击items,选择format,然后Available栏中选择ListText选项卡,设置表格边框 保存为模板,Report-> ...