sockets - Python: Interrupting sender with incoming messages -


i'm working socket, asynchronous event-driven programming. send message, once receive response, send message. may doing besides listening. is, want interrupted when socket.recv() receives message.

question 1: how can let layer 3 interrupt layer 4? i.e. how can handle event of non-null returning socket.recv() without dedicating "program time" wait specific time listen incoming messages?

in asynchronous programming don't interrupt operation triggered message. operations should done in short , fast fashion can process lots of messages per second. way every operation atomic , don't suffer race conditions easily. if in need more complex processing in parallel hand problems on helper thread. libraries twisted prepared such use cases.


Comments