I received a string over TCP socket. And this string looks something like this:
str = "10.100.200.200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
How should I parse this into an IPAddress? If I do this,
IPAddress.TryParse(msg.nonTargetIP.Trim(), out ip);
it fails to parse.
What is simplest way to remove those trailing null’s?
Alternatively reading up on Trim() you could do the following which is probably quicker: