Hi
[font="calibri;"]In my request I have limited my response to 2 characters and my var indicator is light= this works every time[/font]
//Get request
byte[] buffer = new byte[bytesReceived];
int byteCount = clientSocket.Receive(buffer, bytesReceived, SocketFlags.None);
string request = new string(Encoding.UTF8.GetChars(buffer));
Debug.Print(request);
//int countof = request.IndexOf("light="); //for my code
int countof = request.IndexOf("user=");
countof = countof + 6;
//var s = request.Substring(countof, 2); //for my code
You may need to add the following and it may need some tweeking
int noChatTotext = X //(this is the number of char to the end of user= it should constant)
int lengthOfrequest = request.length(); //calculate the length of the hole request sent.
int noCharToGet = lengthOfrequest - noChatTotext; //the length of the text you want
var s = request.Substring(countof, noCharToGet); //S will be the text you want