简体   繁体   English

Python串行写入和套接字发送命令是否受阻?

[英]Are Python serial write and socket send commands blocking?

I am running an into an issue with my python SocketServer application which seems to be blocking some threads intermittently. 我的python SocketServer应用程序出现问题,似乎间歇性地阻塞了一些线程。 I am guessing this could be because of a network outage and somehow the write buffer is overrun and the write is blocked after that. 我猜这可能是由于网络中断以及某种程度上写缓冲区被超限并且此后写被阻塞所致。

These are my questions 1) When I do a write on a serial port and the write buffer is full what happens? 这些是我的问题1)当我在串行端口上执行写操作并且写缓冲区已满时,会发生什么? 2) When the socket send buffer is full will the send block until there is space in the buffer to write? 2)当套接字发送缓冲区已满时,发送块会一直等待直到缓冲区中有空间可写吗?

My Socket server is non-blocking but I want to know what happens in case of a buffer overrun. 我的Socket服务器是非阻塞的,但是我想知道在缓冲区溢出的情况下会发生什么。

I'm not clear exactly what you're experiencing from your post. 我不确定您发布的帖子的确切含义。 You might consider re-reading it and seeing if you can edit for clarity. 您可能会考虑重新阅读它,看看是否可以进行编辑以保持清晰度。

Stuff using SocketServer is known not to be robust and doing bidirectional communication using pyserial can be problematic. 众所周知,使用SocketServer的东西不可靠,并且使用pyserial进行双向通信可能会出现问题。 For concurrency (both network and serial) I would probably be using twisted , which can be more reliable and debuggable. 对于并发(网络和串行),我可能会使用twisted ,它可以更可靠和可调试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM