System.Net.Sockets.TcpClient.TcpClient C# (CSharp) Метод

TcpClient() публичный метод

public TcpClient ( string hostname, int port )
hostname string
port int
        public TcpClient(string hostname, int port)
        {
            if (NetEventSource.IsEnabled) NetEventSource.Enter(this, hostname);

            if (hostname == null)
            {
                throw new ArgumentNullException(nameof(hostname));
            }

            if (!TcpValidationHelpers.ValidatePortNumber(port))
            {
                throw new ArgumentOutOfRangeException(nameof(port));
            }

            // IPv6: Delay creating the client socket until we have
            //       performed DNS resolution and know which address
            //       families we can use.

            try
            {
                Connect(hostname, port);
            }

            catch
            {
                if (_clientSocket != null)
                {
                    _clientSocket.Close();
                }
                throw;
            }

            if (NetEventSource.IsEnabled) NetEventSource.Exit(this);
        }

Same methods

TcpClient::TcpClient ( IPEndPoint localEP )
TcpClient::TcpClient ( ) : System.Diagnostics
TcpClient::TcpClient ( AddressFamily family ) : System.Diagnostics
TcpClient::TcpClient ( Socket acceptedSocket ) : System.Diagnostics