tcplistener_object.AcceptSocket Method

Accepts a TCP connection and returns a new Socket Object for performing I/O on that connection.

...tcplistener_object.AcceptSocket

Prerequisites

The TCP listener associated with the tcplistener_object should have already been started.

Parameters

None

Remarks

This method is used by a TCP server to accept a connection request from a remote TCP client. It creates a new Socket for performing I/O with that client. If no connection requests are pending, this method blocks until one is received. To avoid blocking, use the Pending property before calling AcceptSocket.

If any network errors occur, this method throws an Exception.

Examples

Dim ep As New IPEndPoint("", 1234)   ' Listen on port 1234
Dim tl As New TcpListener(ep) ' Create listener object
Dim sock As Socket
tl.Start
sock = tl.AcceptSocket

See Also

Networking Classes | tcplistener_object.Pending