简体   繁体   中英

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. 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? 2) When the socket send buffer is full will the send block until there is space in the buffer to write?

My Socket server is non-blocking but I want to know what happens in case of a buffer overrun.

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. For concurrency (both network and serial) I would probably be using twisted , which can be more reliable and debuggable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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