Home » Community » Newbie corner » TcpSocket, Know when distant connection have been closed
Re: TcpSocket receiving ghost data [message #57217 is a reply to message #57216] |
Sat, 12 June 2021 17:34   |
Oblivion
Messages: 1212 Registered: August 2007
|
Senior Contributor |
|
|
Hello Xemuth,
That's because that function is meant to convert pointer addresses into hexadecimal notation. What you see is a representation of the address of "data" String. What you need is HexEncode/HexDecode:
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_COUT|LOG_FILE);
String s = "A";
RLOG(s);
RLOG(FormatHex(~s)); // Converts the pointer address to hex.
RLOG(FormatHex(s.ToStd().c_str())); // Converts the pointer address to hex.
RLOG("---");
RLOG(HexEncode(s)); // Encodes the *content* of Strings into hex.
RLOG(HexEncode(s.ToStd().c_str())); // The same...
}
result:
A
7fff1bbab9a8
7fff1bbab958
---
41
41
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Sat, 12 June 2021 17:38] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Tue Jun 17 03:26:20 CEST 2025
Total time taken to generate the page: 0.04401 seconds
|