Sending Telnet Command via TCP/IP Socket

B

Ben

Does anyone kow how I can send the telnet command via socket to
disable Local Echo? I have read RFC857 but I still don't understand
how I structure and send the telnet commands to the server.

Any help would be greatly appreciated.
 
B

Ben

Code Sample

// Connect to a remote device.
try
{
// Establish the remote endpoint for the socket.
// The name of the
// remote device is "host.contoso.com".
// IPHostEntry ipHostInfo =
Dns.Resolve("host.contoso.com");
// IPAddress ipAddress = ipHostInfo.AddressList[0];

IPEndPoint remoteEP = new IPEndPoint(IPAddress, port);

// Create a TCP/IP socket.
client = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);

// Connect to the remote endpoint.
client.BeginConnect(remoteEP,
new AsyncCallback(ConnectCallback), client);
connectDone.WaitOne();


// Receive the response from the remote device.
Receive(client);
receiveDone.WaitOne();

// Write the response to the console.
Console.WriteLine("Response received : {0}",
response);



//// Send test data to the remote device.
Send(client, "admin");
Send(client, System.Environment.NewLine);
sendDone.WaitOne();

// Receive the response from the remote device.
Receive(client);
receiveDone.WaitOne();

// Write the response to the console.
Console.WriteLine("Response received : {0}",
response);

// Send test data to the remote device.
Send(client, "microchip");
Send(client, System.Environment.NewLine);
sendDone.WaitOne();

// Receive the response from the remote device.
Receive(client);
receiveDone.WaitOne();


// Write the response to the console.
Console.WriteLine("Response received : {0}", response);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top