Python open-dis examples not running as expected

330 views Asked by At

I am attempting to get the open-dis python package running correctly on my machine. I am running Python 3.8.

Using pip, I compile the package from it's source as so: pip install .

After that, as instructed in the documentation. I run python dis_receiver.py

I am immediately met with this error:

Created UDP socket 3001
Traceback (most recent call last):
  File "dis_receiver.py", line 40, in <module>
    recv()
  File "dis_receiver.py", line 27, in recv
    data = udpSocket.recv(1024) # buffer size in bytes
socket.timeout: timed out

I don't really understand why this is happening given that I have changed absolutely nothing about the documented example process. Any idea why this would be happening?

1

There are 1 answers

0
Libra On BEST ANSWER

Turns out the socket timeout is set to expire after 3s. This is set here:

udpSocket.settimeout(3) # exit if we get nothing in this many seconds

Simply change that to a higher number to give yourself some extra time, no more socket timeout.

udpSocket.settimeout(20000) # exit if we get nothing in this many seconds