I'm exchanging some data over socket, and at some point of the communication, I need to send a message like this:
SendBuff(#$06 + #$05 + Login, Length(Login) + 2);
Exploding the message:
"#$06" = header, I need to send 06 in the front of this message
"#$05" = length for Login, this is the problem in fact!!
"Login" = the AnsiString containing the login
"Length(Login) + 2" = the length of the buffer to be sent, is the length of the login + 2...
Ok, as I said, the problem is in the #$05, if I write this way, it works, the server recognize the message and authorize (considering the length of login is 5). But if I try this way:
SendBuff(#$06 + IntToStr(Length(Login)) + Login, Length(Login) + 2);
For some reason in fact the socket send the value '35'!!! I tried this:
SendBuff(#$06 + '5' + Login, Length(Login) + 2);
And same problem, the socket sent the value '35'... What's happening here guys? The SendBuff procedure is receiving parameters this way:
procedure SendBuff(InputBuff: AnsiString; PacketSize: Integer);