async socket telnet
This commit is contained in:
@@ -21,7 +21,7 @@ namespace ConsoleApp.TelnetSamples
|
||||
_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
_socket.ReceiveTimeout = 1000;
|
||||
|
||||
IPAddress ipAddress = IPAddress.Parse(ip);
|
||||
IPAddress ipAddress = Dns.GetHostAddresses(ip)[0];
|
||||
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, port);
|
||||
_socket.Connect(ipEndPoint);
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace ConsoleApp.TelnetSamples
|
||||
}
|
||||
}
|
||||
|
||||
public string Read()
|
||||
private string Read()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
byte[] readBuffer = new byte[1024];
|
||||
@@ -48,8 +48,6 @@ namespace ConsoleApp.TelnetSamples
|
||||
|
||||
if (data.EndsWith("\r\n>"))
|
||||
break;
|
||||
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
|
||||
// 에코 삭제
|
||||
|
Reference in New Issue
Block a user