WINSOCK READ STRING$
After having called WINSOCK FETCH PACKET, you may use this command to read a string (x+1 bytes, where x is the length of the string) of the packet's data. Each read command moves the read cursor accordingly.
You have to be cautious when using the read string command, because it reads byte per byte of the packet until it finds a 0-byte (strings are null-terminated). Someone could try to attack your server and make it crash, by sending a packet that he knows will be read by your server using the read string command, but never has a 0 byte.
The Dll will securely manage this for you, so that it won't lead to a crash, but you have to check afterwards the length of the string, and, if it is not correct, reject the packet or even the connection. If you read bytes after having read the string, but you exceed the 255 byte limit of a packet, because the string had not the length you thought it would have, you will crash your program (assertion message if using debug dll).
You can check the length of the packet using WINSOCK PACKET LEN, which returns always the total data length of the actual packet.
SYNTAX
Return String=WINSOCK READ STRING$()
RELATED INFO
WINSOCK command menu
Index
EXAMPLE
Showcase-example 1
Showcase-example 2