c# How to get string from byte?
Posted
by
Kade
on Stack Overflow
See other posts from Stack Overflow
or by Kade
Published on 2013-11-13T03:50:28Z
Indexed on
2013/11/13
3:53 UTC
Read the original article
Hit count: 128
I have a form-console application which does a TCP socket connections for send and receive. I need help getting the following response to STRING. The following code does write the RESPONSE to the console, but i also want to
byte[] b = new byte[100];
int k = s.Receive(b);
Console.WriteLine("Recieved...");
for (int i = 0; i < k; i++)
Console.Write(Convert.ToChar(b[i]));
ASCIIEncoding asen = new ASCIIEncoding();
s.Send(asen.GetBytes("RECEIVED :"));
i want to get something like
String GETSTRING;
byte[] b = new byte[100];
int k = s.Receive(b);
Console.WriteLine("Recieved...");
for (int i = 0; i < k; i++)
Console.Write(Convert.ToChar(b[i]));
GETSTRING = *WHATEVER RESPONSE RECEIVED ABOVE*
ASCIIEncoding asen = new ASCIIEncoding();
s.Send(asen.GetBytes("RECEIVED :"));
© Stack Overflow or respective owner