Metaserver Protocol

From WorldForgeWiki
Jump to: navigation, search

The metaserver keeps a list of running servers and sends this information to clients at will. (If anything is unclear catch Demitar or read the metaserver source.)

Client Requests

The client initiates the listing by sending a LIST_REQ message (UDP) to the server. The current server is located at metaserver.worldforge.org port 8453.

The LIST_REQ message is structured as follows:

  • 32 bit integer message header, in this case 7. This should be encoded to network byte order (htonl()).
  • 32 bit integer, start of listing, the first request it should be 0, if the server has more servers than it can fit in one packet you can set this to a higher value to start from there. Network byte order as well.

The server responds with a LIST_RESP message.

The LIST_RESP message is structured as follows:

  • 32 bit integer message header, in this case 8. Network byte order.
  • 32 bit integer, total servers known by server. Network byte order.
  • 32 bit integer, number of ips in this message. Network byte order.
  • An array of 32 bit integers representing the ips in network byte order (I think), however note that ips are in network byte order in sockaddr anyway.

The authoritive specification of the message numbers can be found here: http://purple.worldforge.org/cvs/metaserver/src/protocol_instructions.h