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

socket.timeout: timed out #42

Closed RudyB closed 8 years ago

RudyB commented 8 years ago

Whenever I try to run a query based on a minecraft server IP, I keep getting the error: "socket.timeout: timed out"

Here is the code I am using: server = MinecraftServer.lookup('mc.charliecraft.com') query = server.query() print("The server has the following players online: {0}".format(", ".join(query.players.names)))

Here is the exact error I am getting:

Traceback (most recent call last):
  File "/mcstatus-master/run.py", line 5, in <module>
    query = server.query()
  File "/mcstatus-master/mcstatus/server.py", line 84, in query
    raise exception
  File "/mcstatus-master/mcstatus/server.py", line 79, in query
    querier.handshake()
  File "/mcstatus-master/mcstatus/querier.py", line 32, in handshake
    packet = self._read_packet()
  File "/mcstatus-master/mcstatus/querier.py", line 25, in _read_packet
    packet.receive(self.connection.read(self.connection.remaining()))
  File "/mcstatus-master/mcstatus/protocol/connection.py", line 172, in read
    result.extend(self.socket.recvfrom(self.remaining())[0])
socket.timeout: timed out
connorlurring commented 8 years ago

You should be using server.status()

RudyB commented 8 years ago

server.status gives me the amount of players, I want the names of the players as well.

connorlurring commented 8 years ago

Oh, sorry, I see what you're trying to do.

Is the server online?

RudyB commented 8 years ago

Yes the server is, the server.status() correctly gives me the amount of players online

connorlurring commented 8 years ago

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

RudyB commented 8 years ago

I'm positive it is

RudyB commented 8 years ago

Server restart fixed the problem. Server had uptime of 4 months