I need to convert a string that has been converted to HEX and sent via TCP to string.
I tried the 2 forms below and I only get illegible string:
public async void HandleConnections(TcpClient client)
{
using (var networkStream = client.GetStream())
{
using (var reader = new StreamReader(networkStream))
{
returndata = await reader.ReadLineAsync();
}
}
}
public async void HandleConnections(TcpClient client)
{
byte[] bytes = new byte[client.ReceiveBufferSize];
string returndata = Encoding.UTF8.GetString (bytes);
Console.WriteLine (returndata);
}