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. 设置Android程序图标和程序标题

    修改程序名称 在/res/values/strings.xml中修改程序名称,例如: <string name="app_name">你的程序名称</string ...

  2. C++之类模板

    C++之类模板 代码如下:  C++ Code  123456789101112131415161718192021222324252627282930313233343536373839404142 ...

  3. JavaScript入门之函数返回值

    函数返回值 <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF ...

  4. 《C++ Primer Plus》第2章 开始学习C++ 学习笔记

    C++程序由一个或多个被称为函数的模块组成.程序从main()函数(全部小写)开始执行,因此该函数必不可少.函数由函数头和函数体组成.函数头指出函数的返回值(如果有的话)的类型和函数期望通过参数传递给 ...

  5. 用MCI处置WAV视频时,怎样才能让视频在当前窗口播放

    用MCI处理WAV视频时,怎样才能让视频在当前窗口播放MCI播放视频默认是新开一个窗口播放,播放完毕返回原来的窗口,想着原来窗口播放如何做? mciSendCommand或mciSendString怎 ...

  6. 如何激励用户为你的app评分?

    如何激励用户为你的app评分? 2014-04-10 16:21 编辑: suiling 分类:营销推广 来源:CocoaChina  0 7247 应用设计应用评分 招聘信息: IOS兼职 深圳创业 ...

  7. oracle如何用sql查看触发器?

    ORACLE查出表所有的触发器及触发器详细信息 一.查all_triggers表得到trigger_name Sql代码 select trigger_name from all_triggers w ...

  8. vue兄弟组件传值

    vue中除了父子组件传值,父传子用props,子传父用$emit,有时候兄弟组件之间也需要传值 1. 先定义一个中间件,src下面新建self.js import Vue from 'vue'; le ...

  9. 160427、CSS3实战笔记--多列布局

    通过阅读和学习书籍<CSS3实战>总结 <CSS3实战>/成林著.—北京机械工业出版社2011.5   多列布局适合纯文字版式设计,如报纸内和杂志类网页布局,不适合做网页结构布 ...

  10. 配置Hibernate的流程

    配置项目的前提下你应该配置好你的开发环境 1新建hibernate.cfg.xml文件,放在src目录里 <?xml version="1.0" encoding=" ...