System::Net::Sockets::TcpListener class

TcpListener class

Represents a listener for the TCP network services. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.

class TcpListener : public System::Object

Methods

MethodDescription
AcceptSocket()Accepts the pending connection request and returns the socket that is used to send and receive data.
AcceptTcpClient()Accepts the pending connection request and returns the TcpClient-class instance that is used for sending and receiving data.
AllowNatTraversal(bool)Enables or disables the NAT traversal.
BeginAcceptSocket(AsyncCallback, System::SharedPtr<Object>)Initiates an asynchronous accept operation.
BeginAcceptTcpClient(AsyncCallback, System::SharedPtr<Object>)Initiates an asynchronous accept operation.
static Create(int32_t)Creates a new instance using the specified port number.
EndAcceptSocket(System::SharedPtr<IAsyncResult>)Waits until the specified asynchronous accept operation completes.
EndAcceptTcpClient(System::SharedPtr<IAsyncResult>)Waits until the specified asynchronous accept operation completes.
get_ExclusiveAddressUse()Gets a value that indicates if the current instance allows only one client to use a port.
get_LocalEndpoint()Returns the underlying endpoint.
get_Server()RTTI information.
Pending()Returns a value that indicates if there are pending connection requests.
set_ExclusiveAddressUse(bool)Sets a value that indicates if the current instance allows only one client to use a port.
Start()Starts listening for the incoming connections.
Start(int32_t)Starts listening for the incoming connections.
Stop()Stops listening for the incoming connections.
TcpListener(System::SharedPtr<IPEndPoint>)Constructs a new instance.
TcpListener(System::SharedPtr<IPAddress>, int32_t)Constructs a new instance.
TcpListener(int32_t)Constructs a new instance.

See Also