Probably a long shot but we’re upgrading from 2019 LTS to 2021 LTS and we’re not really having much luck getting the svyquery to correctly read our server_info
Originally we used this Repo as an example to get us going FPSSample/Assets/Scripts/Networking/SQP.cs at master · Unity-Technologies/FPSSample · GitHub. But that’s now 6 years old
go-svrquery Repo GitHub - Unity-Technologies/go-svrquery: Server Query Protocols in golang
It seems the DataStreamWriter/Reader has changed quite a bit. Now strings won’t correctly write and while I do get some output it refuses to output server_info
{
“version”: 0,
“address”: “192.168.1.100:15951”
}
Is there any actual examples or documentation for this? Seems pretty barren & we’re basically out of ideas at this point besides rewriting the entire backend
Could you provide more details please? The code that reads/writes the data and what “won’t correctly write” and “refuses to output” actually means eg error messages or actual result.
Theres no actual error messages i can see in the code. I can’t provide the exact code due to NDA reasons sorry but its not much different from the SQP.cs link above. One thing i’ve noticed is RequestChunks seems to be different each time & its only really “failing” at the QueryResponseHeader (as in it doesn’t seem to write ServerInfoData in a way that the svrquery tool can read. I only get Version / address with no server_info output)
This is from the SQP.cs above & this is I think where the main difference is from 2019 → 2021. DeferredUShortNetworkByteOrder class no longer exists / WriteString extensions don’t seem to actually write to the writer so I’ve been trying new FixedStringSized writes but not having much luck
public void ToStream(ref DataStreamWriter writer)
{
var lengthValue = QueryHeader.ToStream(ref writer);
var start = (ushort)writer.Length;
var chunkValue = writer.WriteNetworkByteOrder((uint)0);
var chunkStart = writer.Length;
ServerInfoData.ToStream(ref writer);
ChunkLen = (uint)(writer.Length - chunkStart);
QueryHeader.Length = (ushort)(writer.Length - start);
lengthValue.Update(QueryHeader.Length);
chunkValue.Update(ChunkLen);
var length = (ushort)System.Net.IPAddress.HostToNetworkOrder((short)QueryHeader.Length);
var chunkLen = (uint)System.Net.IPAddress.HostToNetworkOrder((int)ChunkLen);
}
Was really just hoping for some upto date examples or documentation if anything exists. Appreciate the reply
Ended up just dropping DataStreamWriter/Reader and used byte buffers. Works allgood now
1 Like
Good. I was eyerolling at that code already because of it using StreamWriter/Reader types. 