1

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?

Libra
  • 2,544
  • 1
  • 8
  • 24
  • Are you also running a sender, as shown by the same example? – mkrieger1 Aug 03 '20 at 21:17
  • @mkrieger1 I am not, as it instructs to run the receiver before the sender. – Libra Aug 03 '20 at 21:18
  • Did you *try* running a sender at the same time? – mkrieger1 Aug 03 '20 at 21:18
  • @mkrieger1 Sender appears to run without issue, giving me the hardcoded feedback message that a packet was sent. – Libra Aug 03 '20 at 21:19
  • And what does the receiver do now that a sender is running? – mkrieger1 Aug 03 '20 at 21:19
  • @mkrieger1 The receiver won't run, it encounters a runtime error... so.. nothing...? – Libra Aug 03 '20 at 21:20
  • In [this commit](https://github.com/open-dis/open-dis-python/commit/66a9de1e83acab8a73c08fdb32bc3ff0e7bb81a6) the author changed the example IP address that is used by the example sender from 127.0.0.1 (localhost) to something else for some reason. Maybe you could try again with 127.0.0.1 so that the sender sends something that can actually be received by the receiver. – mkrieger1 Aug 03 '20 at 21:22
  • @mkrieger1 regardless of what ip I am sending anything on, the receiver isn't going to see it as it literally will not run. I would be sending to nothing. – Libra Aug 03 '20 at 21:24
  • What is the error that you get from the receiver? The one you have shown in the question or now something else? – mkrieger1 Aug 03 '20 at 21:25
  • @mkrieger1 I haven't changed anything... so the one in my question, yes. – Libra Aug 03 '20 at 21:25
  • Did you restart the receiver since the sender was running and sending to 127.0.0.1? – mkrieger1 Aug 03 '20 at 21:28
  • The sender is not a service that is referenced by the receiver at all, it just sends a message that the looping receiver should theoretically be able to catch, no matter what is changed in the sender, even if the file was completely blank, it should not impact how the receiver functions. Just to humor the suggestion, I did just try that, and was met with the same result. – Libra Aug 03 '20 at 21:30
  • 1
    Maybe you should send a bug report and ask that they clarify their examples. – mkrieger1 Aug 03 '20 at 21:32
  • I hear you. I'm tracking an improvement to the example sender/receiver here: https://github.com/open-dis/open-dis-python/issues/21 – Leif Gruenwoldt Nov 19 '20 at 02:19

1 Answers1

1

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
Libra
  • 2,544
  • 1
  • 8
  • 24