I\'m testing UDP punching using code from here. It works on Linux however reports error on Windows. Here\'s the code snippet where the error occurs:
while True:
Unfortunately, select
will not help you to process stdin
and network events in one thread, as select
can't work with streams on Windows. What you need is a way to read stdin
without blocking. You may use:
stdin
. That should work fine and be the easiest way to do the job. Python threads support is quite ok if what you need is just waiting for I/O events.twisted
(see the comments) that offer non-blocking file I/O. This way is the most consistent one, but it should require to write the whole application using a style that matches your framework (twisted
or gevent
, the difference is not significant). However, I suspect twisted
wrappers are not capable of async input from stdin
on Windows (quite sure they can do that on *nix, as probably they use the same select
).