Class TcpListener
TcpListener class. Used to manage the TCP connection to a client.
Inheritance
System.Object
TcpListener
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Cosmos.System.Network.IPv4.TCP
Assembly: Cosmos.System2.dll
Syntax
public class TcpListener : IDisposable
Constructors
| Improve this Doc View SourceTcpListener(UInt16)
Create new instance of the TcpListener class.
Declaration
public TcpListener(ushort localPort)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | localPort | Local port. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown on fatal error (contact support). |
System.ArgumentException | Thrown if localPort already exists. |
Methods
| Improve this Doc View SourceAcceptTcpClient(Int32)
Receive TcpClient from remote computer.
Declaration
public TcpClient AcceptTcpClient(int timeout = -1)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | timeout |
Returns
Type | Description |
---|---|
TcpClient | Accepted TcpClient |
Exceptions
Type | Condition |
---|---|
System.Exception | Thrown if TcpListener not started. |
Dispose()
Close listener
Declaration
public void Dispose()
Start()
Start listening for new TCP connections.
Declaration
public void Start()
Exceptions
Type | Condition |
---|---|
System.OverflowException | Thrown on fatal error (contact support). |
Stop()
Stop listening for new TCP connections.
Declaration
public void Stop()
Exceptions
Type | Condition |
---|---|
System.OverflowException | Thrown on fatal error (contact support). |
System.Exception | Thrown if TcpListener not started. |
Implements
System.IDisposable