I was thinking about something like this:
https://gist.github.com/rvk01/ac22d368b8d1f7d537cf0c67389bda20

SHA1 was easy to replace with the version from Synapse (it was indeed already there ;) ).

For reading I did it like this:
Created a function GetCompletePacket which should always return a complete packet from the server.
(see the github gist above)

It reads 4 bytes with Sock.RecvBufferEx.
It checks the first 3 bytes for the length of the package.
It checks the 4th byte for the packagenumber (which should be in order)
It read the complete package length with Sock.RecvBufferEx.
So it shouldn't return until the timeout or the complete package is read.

For initial handshake a timeout of 2 seconds should be enough.
For bigger queries, a bigger timeout should be chosen.

(Still a rough draft ;) )

Grtz,
Rik


Op 07-08-2023 om 06:25 schreef Rik van Kekem:
Because the packages for authentication are small, I don't think these would 
ever be fragmented. But going further with larger data packages you can't rely 
on that fact. Then you'll need to use a buffer mechanisme.
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to