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. C++之运算符重载

     C++ Code  12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 ...

  2. server.xml详解

    http://www.cnblogs.com/gugnv/archive/2012/02/01/2334187.html http://blog.csdn.net/weinianjie1/articl ...

  3. python虚拟环境的使用---virtualenv and virtualenvwrapper

    虚拟环境 virtualenv 常用操作 step1: 安装 : pip install virtualenv step2:新建 : virtualenv venv cd venv activate ...

  4. C语言字符串的输入输出

    字符串的输出 在C语言中,输出字符串的函数有两个: puts():直接输出字符串,并且只能输出字符串. printf():通过格式控制符 %s 输出字符串.除了字符串,printf() 还能输出其他类 ...

  5. ios开发-获取手机相关信息

    今天在做客户端的时候,里面有个意见反馈功能. 调用系统带的邮件功能,发送邮件到指定邮箱. 然后我就想,应该在邮件正文部分添加手机相关内容,比如型号,版本,应用程序的版本等等,这样不仅使用者方便,开发者 ...

  6. NIO概览

    NIO专题:http://developer.51cto.com/art/201112/307172.htm 一.新IO概述: 新IO和传统IO都是用于进行输入/输出,相比于传统IO面向流的处理方式, ...

  7. XXL-JOB分布式任务调度平台安装与部署

    配XXL-JOB分布式任务调度平台安装与部署

  8. 如何让ie9.0以下的浏览器支持getElementsByClassName

    如何让ie9.0以下的浏览器支持getElementsByClassName     /** * node是表示dom树的搜索起点,Classname是需要搜索的类名. * 如果传入的节点上已经存在了 ...

  9. Spring的AOP-----HelloWord

    这里就一个计算器开发为例1搭建环境-搭配好Spring的AOP开发环境导入以下这些包:2建立好核心处理模块的类ArithmeticCalculator: package com.jeremy.spri ...

  10. EntityFramework.DynamicFilters 实现软删除和租户过滤

    EntityFramework.DynamicFilters 实现软删除和租户过滤