I’m programming a telnet admin system that request to user to input a command.
I can read it from the socket with a network stream but when I compare the string to another I can’t get a match, i have tried Regex..
So here is my code:
while (!bit.Contains("\r") && !bit.Contains("\n") && !bit.Contains("."))
{
bit = Encoding.ASCII.GetString(buffer);
outputString += bit;
stream.Read(buffer, 0, 1);
}
// Read till user input ENTER
if ( outputString == "$edit" )
// do something
It’s obvious that you must move first line of the loop: