我收到一个 UDP 数据包,如下所示:
<<83,65,77,80,188,64,171,138,30,120,105,0,0,0,10,0,4,0,0,0,84,101,115,116,15,0,0,0,82,101,122,111,110,101,32,82,111,108,101,80,108,97,121,11,0,0,0,83,97,110,32,65,110,100,114,101,97,115>>
如果我知道我可以删除前 11 个字节,并且 12-13 字节包含服务器上在线玩家的数量(字节宽度为 2),我该如何解码数据包,我怎样才能得到这个数量?
UPD
也许我发送了不正确的数据包...
SAMP 查询
所以,我发送:
<<$S,$A,$M,$P,188,64,172,136,7808:16,$i>>
对于服务器 188.64.172.136:7808,我得到
<<83,65,77,80,188,64,172,136,30,128,105,0,0,0,10,0,4,0,0,0,84,101,115,116,15,0,0,0,82,101,122,111,110,101,32,82,111,108,101,80,108,97,121,11,0,0,0,83,97,110,32,65,110,100,114,101,97,115>>