New TcpClient Constructor

Constructor for creating a TcpClient Object and optionally connecting to a remote TCP server.

New TcpClient (endpoint)

Prerequisites

None

Parameters

endpoint

An optional IPEndPoint Object that contains the IP address and port identifying the remote endpoint of a TCP server. If omitted, a Connect method must be called later for the TCP client Socket before I/O can be performed.

Remarks

This constructor creates a new TcpClient Object and creates the underlying Socket. If the optional endpoint parameter is specified, a connect request is sent immediately to the remote server. If it is omitted, a Connect method must be called for the TCP client Socket before I/O can be performed.

Examples

Dim ep As New IPEndPoint("192.168.0.2", 1234)   ' Port 1234 at address 192.168.0.2
Dim tc As New TcpClient(ep) ' Connect to remote endpoint

Dim
tc As New TcpClient() ' Create socket but do not connect

See Also

Networking Classes | socket_object.Connect