在Linux环境中将串行端口数据转换为TCP/IP [英] Converting serial port data to TCP/IP in a Linux environment

查看:131
本文介绍了在Linux环境中将串行端口数据转换为TCP/IP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从Linux系统的串行端口获取数据并将其转换为TCP/IP以发送到服务器.这很难吗?我有一些基本的编程经验,但是对Linux没有太多的经验.是否有一个开源应用程序可以做到这一点?

I need to get data from the serial port of a Linux system and convert it to TCP/IP to send to a server. Is this difficult to do? I have some basic programming experience, but not much experience with Linux. Is there an open source application that do this?

推荐答案

您无需编写程序即可在Linux中执行此操作.只需管道通过

You don't need to write a program to do this in Linux. Just pipe the serial port through netcat:

netcat www.example.com port </dev/ttyS0 >/dev/ttyS0

只需替换地址和端口信息.另外,您可能正在使用其他串行端口(即更改/dev/ttyS0部分).您可以使用 stty

Just replace the address and port information. Also, you may be using a different serial port (i.e. change the /dev/ttyS0 part). You can use the stty or setserial commands to change the parameters of the serial port (baud rate, parity, stop bits, etc.).

这篇关于在Linux环境中将串行端口数据转换为TCP/IP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆