如何将数据从串口传输到以太网端口?
我需要将数据从串口传输到以太网端口。 如何做呢? 使用软件+硬件还是只使用硬件? 如果是这样,我可以采取什么方式来解决这个问题,如果可以使用软件来完成,是否可以使用 C 来完成?
I need to transfer data from the serial port to the Ethernet port . How can it be done? Using software + hardware or only hardware will do? If so what is the way I can go about it and if it can be done using software is it possible using C?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您的目标是将串行设备连接到以太网,则可以购买串行到以太网“适配器”,例如 此 或此 。
我想您还可以编写一个后台服务(用您选择的语言)来侦听串行端口上的数据,并将其重新传输到网络上,但我认为预打包的适配器不会那么麻烦。
If your goal is to attach a serial device to an Ethernet network, you can purchase a serial-to-ethernet "adapter," such as this or this.
I suppose you can also write a background service (in your language of choice) that listens for data on the serial port, and retransmits it onto the network, but I would think a pre-packaged adapter would be less of a hassle.
您使用的是 PC 还是嵌入式设备?
如果您运行的是 Windows,请查看此 MSDN 文章:串行通信Windows
一旦您检索到缓冲区,您就可以通过 TCP/IP 或 UDP 进行写入(有很多相关教程,具体取决于您想要如何执行此操作)。
如果您需要在嵌入式设备上执行此操作,可以购买适配器,尽管您可能可以使用 Netburner 系统之类的东西来推出自己的适配器(它会更昂贵,但您可以控制功能)。
Are you using a PC or is this for an embedded device?
If you're running Windows, take a look at this MSDN article: Serial Communications in Windows
Once you have retrieved your buffer, you can write over TCP/IP or UDP (Lots of tutorials for this available, depending on how you want to do this).
If you need to do this on an embedded device, there are adapters available for purchase, though you can probably roll your own with something like a Netburner system (It'll be more expensive, but you have control over the functionality).
Eterlogic 的 VSPE 包括一个 API 和/或应用程序,用于创建专门用于与串行端口连接的 tcpServer 和 tcpClient。 win32 是免费的,64 位需要少量费用。 (http://www.eterlogic.com/Products.VSPE.html)
VSPE from Eterlogic includes an API and/or and application for creating tcpServer and tcpClient specifically for interfacing with serial ports. Its free for win32, small fee for 64bit. ( http://www.eterlogic.com/Products.VSPE.html )