I write this simple code to get data from socket:
private void DataReceive()
{
try
{
byte[] bytes = new byte[1000];
int byteRec;
while (true)
{
while (true)
{
byteRec = handler.Receive(bytes);
if (byteRec > 0)
{
data = System.Text.Encoding.ASCII.GetString(bytes, 0, byteRec);
break;
}
}
FillLstMsg(data);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
but i want to get data from HEX format,or i see data in hex format?,how can i do this?