2009-06-27 4 views

답변

4

를 소리 텍스트 명령으로 충분할 수 있습니다.

실제 텔넷 서버에 연결하려면 텔넷 이스케이프 시퀀스 처리, 터미널 에뮬레이션 처리, 대화식 명령 처리 등이 필요할 수 있습니다. Minimalistic Telnet library from CodeProject (무료) 또는 상용 텔넷/터미널 에뮬레이터 라이브러리 (예 : Rebex Telnet) 시간을 절약 할 수 있습니다. (this url에서 촬영) 코드에 따라

그것을 사용하는 방법을 보여줍니다

// create the client 
Telnet client = new Telnet("servername"); 

// start the Shell to send commands and read responses 
Shell shell = client.StartShell(); 

// set the prompt of the remote server's shell first 
shell.Prompt = "servername# "; 

// read a welcome message 
string welcome = shell.ReadAll(); 

// display welcome message 
Console.WriteLine(welcome); 

// send the 'df' command 
shell.SendCommand("df"); 

// read all response, effectively waiting for the command to end 
string response = shell.ReadAll(); 

// display the output 
Console.WriteLine("Disk usage info:"); 
Console.WriteLine(response); 

// close the shell 
shell.Close(); 
관련 문제