将 TCP Twisted 应用程序移植到串行端口
我使用 Twisted 一段时间了,通过网络将计算机与某些设备连接起来。我编写了一个自定义协议和工厂。
factory = TModBusFactory()
reactor.listenTCP(9007, factory)
现在我想将设备连接到服务器计算机的串行端口。据我所知,不需要更改协议,但我需要从通过 TCP 发送字节切换为通过串行端口发送字节。
这个改变有多难做到?如何更改代码片段才能使其正常工作?
谢谢!
I've been using Twisted for a while to connect a computer with some devices over the net. I wrote a custom Protocol and Factory.
factory = TModBusFactory()
reactor.listenTCP(9007, factory)
Now I'd like to connect the devices to the serial port of the server machine. As long as I know, no change in the protocol is needed but I need to switch from sending bytes over TCP to send them over the serial port.
How hard to do is this change? How can I change the code snippet in order to make it work?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
串行端口设置如下所示:
Serial port setup looks like this: