Могу ли я остановить сервер от эха каждой команды, которую я посылаю ему?
Это часть моего кода:
Socket s = ConnectSocket(server, port);
if (s == null)
return ("Connection failed");
int bytes = 0;
string ret = "";
bytes = s.Receive(bytesReceived, bytesReceived.Length, SocketFlags.None);
ret = Encoding.ASCII.GetString(bytesReceived, 0, bytes);
//ret="????!????BCM96358 xDSL Router\r\nLogin: "
ret = ret.Substring(12); //Remove the telnet header: 255,253,1,255, 253, 33,255, 251, 1,255, 251, 3
//IAC,DO,Echo, IAC,DO,Remote Flow Control, IAC,WILL,Echo, IAC,WILL,Suppress Go Ahead
request = "Admin\r\n";
bytesSent = Encoding.ASCII.GetBytes(request);
s.Send(bytesSent, bytesSent.Length, 0);
bytes = s.Receive(bytesReceived, bytesReceived.Length, SocketFlags.None);
ret = Encoding.ASCII.GetString(bytesReceived, 0, bytes);
//ret = "Admin\r\nPassword: "