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. LoadRunner中winsocket协议学习

    首先让我们先看一下loadrunner- winsock 函数 一览表:        lrs_accept_connection 接受侦听套接字连接 lrs_close_socket 关闭打开的套接 ...

  2. 【NLP】主题识别文档

    http://www.biostatistic.net/thread-94974-1-1.html http://www.doc88.com/p-9843685205530.html http://w ...

  3. wpf中用户控件的属性重用

    我们经常会抽取一些可重用的控件,某个属性是否需要重用,直接决定了这个属性的绑定方式. 1.完全不可重用的控件 有一些与业务强相关的控件,它们的属性完全来自ViewModel,越是相对复杂的控件,越容易 ...

  4. Java Web项目--使用JSP生成一个页面

    我们使用了servlet生成了一个网页,但是可以看到使用servlet生成网页必须将网页的内容全部嵌入到Java代码当中,不是很方便.所以有没有什么办法是将Java代码嵌入到html代码中,而不是像s ...

  5. 【黑金原创教程】【TimeQuest】【第二章】TimeQuest模型角色,网表概念,时序报告

    声明:本文为黑金动力社区(http://www.heijin.org)原创教程,如需转载请注明出处,谢谢! 黑金动力社区2013年原创教程连载计划: http://www.cnblogs.com/al ...

  6. sql 提升查询效率 group by option hash group

    问题: 一个程序查询经常超过20siis限制时间,排查问题后发现其中的一个存储过程时间会在15s左右 解决思路: 1:确认问题点 通过输出时间的方式查看存储过程中每个部分的执行时间,找到最耗时的三个过 ...

  7. 比较好用的Opera 翻译工具 ddict

    http://ddict.me

  8. angular4 form表单验证

    <!-- novalidate 清除浏览器默认的校验行为 --> <form [formGroup]="formModel" (ngSubmit)="o ...

  9. 知问前端——html+jq+jq_ui+mySql+ajax

    **************************************************************************************************** ...

  10. 解决;R语言使用sqldf库是报错"Failed to connect to database: Error: Access denied for user '..'@'localhost' (using password: NO) Error in !dbPreExists : invalid argument type"

    原因:在使用sqldf时,不需要加载RMySQL库 解决方案:在控制台执行释放RMySQL库加载 detach("package:RMySQL", unload=T);