Search code examples
protocolsminecraft

Minecraft Server Query Protocol. What does SessionId field identify?


I'm writing some app with this protocol. And I don't understand what does SessionId field identify. There are two ways.

First, it's used to identify an every single request-response packages pair and I should generate it again for every request.

Or, it's used to identify clients which tries to get status of server and I should generate it once for every server I connect to.

Are there any ideas?


Solution

  • Okay. I got it. SessionId can contain any Int32 number if SessionId & 0x0f0f0f0f == SessionId. What it identifies is about what you want to do. All ways are correct.

    For my project I generate it randomly for each packet I send.