开发者

Is it possible to disable ECHO when using socket for telnet?

Can I stop server from echo every command i send to it?

This is part of my code:

 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";
  bytesSe开发者_开发百科nt = 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: "


For me sending this sequence has solved problem of echo.

"\xFF\xFB\x01\xFF\xFB\x03"

in other words it's equal to IAC WILL ECHO IAC WILL SUPPRESS-GO-AHEAD


What makes you think it is echoing? Have a look at what's happening at the network level using Wireshark. I strongly suspect that the echo is occurring at the client, not the server.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜