i forgot to add that if i comment that if i comment the // buffer := Buf2Hex(buffer); line i get which looks better but still gives the packet out of order error 03 73 68 6f 77 20 64 61 74 61 62 61 73 65 73 3b .show databases; 00 .
On Mon, 7 Aug 2023 10:32:41 -0600 paste...@gmx.com wrote: > > if i showed you what i had done for the password auth i think you would laugh > - i got as far as using the XOR but my code didn't look at all like yours > (which works nicely) > > i tried to do the following but i don't seem to get what is going on here - > i'd appreciate if you could show me the error of my ways > > // following https://mariadb.com/kb/en/com_query/ > // this code is put above break; // or do something else here > > Buffer := 'show databases;'; > writeln(Buffer); > buffer := Buf2Hex(buffer); > Buffer := #03 + Buffer + #0; // #03 com_query header #0 <eof> > writeln(Buffer); > sock.sendstring(buffer); > buffer := sock.recvpacket(2000); > writeln(Buffer); > > > //get > //show databases; > // 73 68 6F 77 20 64 61 74 61 62 61 73 65 73 3B missing #03/com_query > header and #0/<eof> ?? > //!��#08S01Got packets out of order > //Done, press enter to exit > > > > > > > > > > On Mon, 07 Aug 2023 06:25:50 +0200 > Rik van Kekem <r...@graficalc.nl> wrote: > > > You can use RecvPacket (it is high level and reads from the linebuffer). > > But I think what is meant here is that you can't expect RecvPacket to > > always get the entire package. The incoming data could be split up into > > several parts. > > > > Each package is preceded by a length (in 3 bytes) and a package number. So > > when processing your incoming data you need to keep reading the buffer > > (keep doing buffer := buffer + recvpacket(2000) until you are sure you have > > the complete data package from the server before proceeding with processing > > that package. (You can peek or read in the buffer to see the header for > > checking the needed length of the buffer). > > > > 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. > > > > Maybe there is another way of looking at it. Other views and reading > > techniques are welcome 🤗 > > > > Grtz, > > Rik > > > > > > paste...@gmx.com schreef op 7 augustus 2023 02:20:54 CEST: > > > > > >Lukas would you mind expanding on what you said > > > > > >'It is stream based protocol, not packet based. So, usage of RecvPacket is > > >a big mistake here.' > > > > > >then it seems to be 'contradicted' by > > > > > >'on the reply packet structure. It using RecvPacket internally, and > > >receive multiple packets if it is needed.' > > > > > > > > > _______________________________________________ > > synalist-public mailing list > > synalist-public@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/synalist-public > > > _______________________________________________ > synalist-public mailing list > synalist-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/synalist-public _______________________________________________ synalist-public mailing list synalist-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/synalist-public