Dinnerbone / mcstatus

A Python class for checking the status of an enabled Minecraft server
http://dinnerbone.com/minecraft/tools/status/
1.11k stars 146 forks source link

Time out on 1.8.8 server #40

Closed Bunkerbewohner closed 5 years ago

Bunkerbewohner commented 9 years ago

Hi,

i'm trying to use mcstatus to query the player list of my minecraft server. Unfortunately, no matter what I try, it doesn't work:

Python 2.7.9 (default, Apr  2 2015, 15:33:21) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mcstatus
>>> server = mcstatus.MinecraftServer.lookup(myserverurl)
>>> server
<mcstatus.server.MinecraftServer instance at 0x7f5000eaa560>
>>> server.ping()
69.326
>>> q = server.query()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/mcstatus/server.py", line 82, in query
    raise exception
socket.timeout: timed out

Traceback:

Traceback:
File "/home/mathias/.local/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/mathias/Projects/mclobby/mclobby/views.py" in query
  26.         query = server.query()
File "/home/mathias/.local/lib/python3.4/site-packages/mcstatus/server.py" in query
  82.             raise exception
File "/home/mathias/.local/lib/python3.4/site-packages/mcstatus/server.py" in query
  77.                 querier.handshake()
File "/home/mathias/.local/lib/python3.4/site-packages/mcstatus/querier.py" in handshake
  32.         packet = self._read_packet()
File "/home/mathias/.local/lib/python3.4/site-packages/mcstatus/querier.py" in _read_packet
  25.         packet.receive(self.connection.read(self.connection.remaining()))
File "/home/mathias/.local/lib/python3.4/site-packages/mcstatus/protocol/connection.py" in read
  172.             result.extend(self.socket.recvfrom(self.remaining())[0])

The calls server.status() and server.ping() work just fine. Also on the example page http://dinnerbone.com/minecraft/tools/status/ I can query my server, presumably using the same code. Any idea what could be the problem?

ctian1 commented 9 years ago

This probably doesn't belong here because it's not a problem with the library, it's likely an issue on your side

Bunkerbewohner commented 9 years ago

Yes, it probably is a problem on my side. But since this is the GitHub repository of the person who wrote the library, I hoped that the author or someone else using it might have an idea what that problem may be.

I opened up the Minecraft query port on my (the querying) computer and made it publicly available both via TCP and UDP. This doesn't make a difference unfortunately.

connorlurring commented 8 years ago

42 fixed this with a restart

ixevix commented 8 years ago

I have the same problem with server.query(). Also the request works fine through your example site. This make me wonder if the example code is up to date?

ixevix commented 8 years ago

I also tried restarting the server. Didn't help, and I don't see why it should since it works from your site.

connorlurring commented 8 years ago

@ixevix Ensure enable-query is set to true in your server.properties

ixevix commented 8 years ago

The player list works fine from https://dinnerbone.com/minecraft/tools/status/

ixevix commented 8 years ago

enable-query seems to have fixed the issue for my vanilla server. However my bukkit server is still affected. Vanilla is 1.8.9 and bukkit is 1.8.7.

ixevix commented 8 years ago

And my bad again. The configfile was readonly on the bukkit one. Now it's working properly. I was just curious how it was working on that dinnerbone site even without enable-query

kevinkjt2000 commented 5 years ago

Seems that this question is resolved.