Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-951

submitting query while server starts results in "end of stream"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • Minecraft 1.4.2
    • Amazon EC2 Linux instance
    • Unconfirmed
    • Survival

      I wrote a monitoring app that boots an ec2 instance and then starts a minecraft server on that instance. While everything is starting up, about every 3 seconds, the app submits a status query to get the server's state and the number of players logged in. When I attempt to log in with my minecraft client, I get the "end of stream" message. This happens consistently. If I start the server WITHOUT sending the query request, everything starts normally. This happens even if I send the status query ONLY ONCE, so it's not that the server thinks I'm spamming it. Below is the python code I'm using to send the status query (from Will Nowak <wan@ccs.neu.edu>).

      def GetMCStatus(hostname, port=25565, timeout=0.5):
      """Query a minecraft beta server.

      Args:
      hostname: (String) hostname of the server to connect to
      port: (integer) port number to connect to
      timeout: (float) timeout in seconds for making a TCP connection

      Returns:
      list: If successful, something like:
      [True, 'MOTD here', 5, 20] # Online, MOTD, cur_players, max_players
      If unsuccessful, returns [False]
      """
      logging.debug('Trying to establish connection to %s:%d with timeout %f',
      hostname, port, timeout)
      try:
      s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      ip = socket.gethostbyname(hostname)
      s.connect((ip, port))
      s.settimeout(timeout)
      s.send(chr(254))
      data, _ = s.recvfrom(2048)
      if data and data[0] == chr(255):
      data, _ = codecs.utf_16_be_decode(data[1:])
      data = data[1:]
      p = data.split(u'\xa7')
      return [True] + p
      except socket.error:
      logging.exception('Socket error when querying from %s', hostname)
      return [False]

            Unassigned Unassigned
            cmacrander Chris Macrander
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: