PC Review


Reply
Thread Tools Rate Thread

Sending Telnet Command via TCP/IP Socket

 
 
Ben
Guest
Posts: n/a
 
      17th Apr 2012
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.
 
Reply With Quote
 
 
 
 
Ben
Guest
Posts: n/a
 
      17th Apr 2012
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);
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Memory configurations in socket?2x256 socket 1/3 and 2x512 socket GT Windows Vista Hardware 1 25th Nov 2007 07:18 AM
Socket.BeginSendTo and Socket.BeginSendFrom on a single Socket instancefrom multiple threads Jonas Hei Microsoft Dot NET Framework 9 5th Jul 2005 03:27 AM
Socket.BeginSendTo and Socket.BeginSendFrom on a single Socket instancefrom multiple threads Jonas Hei Microsoft C# .NET 2 22nd Jun 2005 12:10 PM
after opening socket, sending data then closing socket 3000 times i get "Only one usage of each socket address" Daniel Microsoft Dot NET 1 15th Mar 2005 12:37 PM
after opening socket, sending data then closing socket 3000 times i get "Only one usage of each socket address" Daniel Microsoft Dot NET Framework 3 12th Feb 2005 03:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:41 AM.