Class UdpClient
UdpClient class. Used to manage the UDP connection to a client.
Implements
Inherited Members
Namespace: Cosmos.System.Network.IPv4.UDP
Assembly: Cosmos.System2.dll
Syntax
public class UdpClient : IDisposable
Constructors
| Improve this Doc View SourceUdpClient()
Create new instance of the UdpClient class.
Declaration
public UdpClient()
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown on fatal error (contact support). |
System.ArgumentException | Thrown if UdpClient with localPort 0 exists. |
UdpClient(Address, Int32)
Create new instance of the UdpClient class.
Declaration
public UdpClient(Address dest, int destPort)
Parameters
Type | Name | Description |
---|---|---|
Address | dest | Destination address. |
System.Int32 | destPort | Destination port. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown on fatal error (contact support). |
System.ArgumentException | Thrown if UdpClient with localPort 0 exists. |
UdpClient(Int32)
Create new instance of the UdpClient class.
Declaration
public UdpClient(int localPort)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | 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 SourceClose()
Close connection.
Declaration
public void Close()
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown on fatal error (contact support). |
Connect(Address, Int32)
Connect to client.
Declaration
public void Connect(Address dest, int destPort)
Parameters
Type | Name | Description |
---|---|---|
Address | dest | Destination address. |
System.Int32 | destPort | Destination port. |
Dispose()
Close Client
Declaration
public void Dispose()
NonBlockingReceive(ref EndPoint)
Receive data from end point.
Declaration
public byte[] NonBlockingReceive(ref EndPoint source)
Parameters
Type | Name | Description |
---|---|---|
EndPoint | source | Source end point. |
Returns
Type | Description |
---|---|
System.Byte[] | byte array value. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown on fatal error (contact support). |
Receive(ref EndPoint)
Receive data from end point.
Declaration
public byte[] Receive(ref EndPoint source)
Parameters
Type | Name | Description |
---|---|---|
EndPoint | source | Source end point. |
Returns
Type | Description |
---|---|
System.Byte[] | byte array value. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown on fatal error (contact support). |
Send(Byte[])
Send data to client.
Declaration
public void Send(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | Data array to send. |
Exceptions
Type | Condition |
---|---|
System.Exception | Thrown if destination is null or destinationPort is 0. |
System.ArgumentException | Thrown on fatal error (contact support). |
System.OverflowException | Thrown if data array length is greater than Int32.MaxValue. |
Send(Byte[], Address, Int32)
Send data.
Declaration
public void Send(byte[] data, Address dest, int destPort)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | Data array. |
Address | dest | Destination address. |
System.Int32 | destPort | Destination port. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown on fatal error (contact support). |
System.OverflowException | Thrown if data array length is greater than Int32.MaxValue. |