TcpListener::Server Property

 

Gets the underlying network Socket.

Namespace:   System.Net.Sockets
Assembly:  System (in System.dll)

public:
property Socket^ Server {
	Socket^ get();
}

Property Value

Type: System.Net.Sockets::Socket^

The underlying Socket.

TcpListener creates a Socket to listen for incoming client connection requests. Classes deriving from TcpListener can use this property to get this Socket. Use the underlying Socket returned by the Server property if you require access beyond that which TcpListener provides.

System_CAPS_noteNote

The Server property only returns the Socket used to listen for incoming client connection requests. Use the AcceptSocket method to accept a pending connection request and obtain a Socket for sending and receiving data. You can also use the AcceptTcpClient method to accept a pending connection request and obtain a TcpClient for sending and receiving data.

The following code example demonstrates the use of the Server property. The underlying Socket is retrieved and the LingerSocket option is configured to time out after 10 seconds if data still remains in the network buffer after the connection is closed.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: