c# How to get string from byte?
- by Kade
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 :"));