|
|
@ -64,12 +64,10 @@ namespace Apewer.Network |
|
|
|
/// <param name="endpoint">远程终结点。</param>
|
|
|
|
/// <param name="timeout">连接超时毫秒数。当达到指定时长,或达到系统默认时长时,将会发生超时异常。</param>
|
|
|
|
/// <exception cref="ArgumentNullException" />
|
|
|
|
/// <exception cref="ArgumentOutOfRangeException" />
|
|
|
|
/// <exception cref="SocketException" />
|
|
|
|
public TcpClient(IPEndPoint endpoint, int timeout) |
|
|
|
{ |
|
|
|
if (endpoint == null) throw new ArgumentNullException(nameof(endpoint)); |
|
|
|
if (timeout < 1) throw new ArgumentOutOfRangeException(nameof(timeout)); |
|
|
|
|
|
|
|
_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); |
|
|
|
_socket.Connect(endpoint, timeout); |
|
|
|