Class UdpSocket
A UDP socket.
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class UdpSocket : DatagramSocket
Constructors
UdpSocket(Boolean)
Initializes a new instance of the UdpSocket class.
Declaration
public UdpSocket(bool ipv6)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | ipv6 | Whether an IPv6 socket should be created. |
UdpSocket(Boolean, Int32, Int32)
Initializes a new instance of the UdpSocket class.
Declaration
public UdpSocket(bool ipv6, int sendBufferSize, int receiveBufferSize)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | ipv6 | Whether an IPv6 socket should be created. |
System.Int32 | sendBufferSize | The desired send buffer size. |
System.Int32 | receiveBufferSize | The desired receive buffer size. |
Properties
DefaultReceiveBufferSize
Gets or sets the default socket receive buffer size. Defaults to 65536. A negative value indicates that the receive buffer size will not be set.
Declaration
public static int DefaultReceiveBufferSize { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
DefaultSendBufferSize
Gets or sets the default socket receive buffer size. Defaults to 512,000. A negative value indicates that the receive buffer size will not be set.
Declaration
public static int DefaultSendBufferSize { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
DisableSocketIOControl
Gets or sets whether Socket.IOControl should be disabled.
Declaration
public static bool DisableSocketIOControl { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IPv6
Gets a value indicating whether the socket supports IPv6.
Declaration
public override bool IPv6 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
IsClosed
Gets a value indicating whether this instance is closed.
Declaration
public override bool IsClosed { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
LocalIPAddress
Gets the local IP address.
Declaration
public override string LocalIPAddress { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
LocalPort
Gets the local port.
Declaration
public override int LocalPort { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Overrides
MaxQueuedPackets
Gets or sets the maximum number of packets that can be queued at any given point in time.
Declaration
public override int MaxQueuedPackets { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Overrides
ReceiveBufferSize
Gets the current receive buffer size.
Declaration
public override int ReceiveBufferSize { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Overrides
ReceiveQueue
Gets the receive queue. For testing purposes only.
Declaration
public BitrateQueue ReceiveQueue { get; }
Property Value
Type | Description |
---|---|
BitrateQueue |
SendBufferSize
Gets the current send buffer size.
Declaration
public override int SendBufferSize { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Overrides
SendQueue
Gets the send queue. For testing purposes only.
Declaration
public BitrateQueue SendQueue { get; }
Property Value
Type | Description |
---|---|
BitrateQueue |
Socket
Gets the underlying socket.
Declaration
public Socket Socket { get; }
Property Value
Type | Description |
---|---|
Socket |
Methods
Bind(String, Int32, out Boolean)
Binds the socket to a local endpoint.
Declaration
public override bool Bind(string ipAddress, int port, out bool addressInUse)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The local IP address. |
System.Int32 | port | The local port. |
System.Boolean | addressInUse | Indicates that access to the address is forbidden or in use. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Close()
Closes the socket.
Declaration
public override void Close()
Overrides
RaiseReceiveSuccess(Action3<DataBuffer, String, Int32>, DataBuffer, String, Int32)
Invokes the receive success callback.
Declaration
protected override void RaiseReceiveSuccess(Action3<DataBuffer, string, int> callback, DataBuffer buffer, string ipAddress, int port)
Parameters
Type | Name | Description |
---|---|---|
Action3<DataBuffer, System.String, System.Int32> | callback | The callback. |
DataBuffer | buffer | The buffer. |
System.String | ipAddress | The IP address. |
System.Int32 | port | The port. |
Overrides
ReceiveAsync(Action3<DataBuffer, String, Int32>, Action1<Exception>)
Receives data asynchronously.
Declaration
public override void ReceiveAsync(Action3<DataBuffer, string, int> onSuccess, Action1<Exception> onFailure)
Parameters
Type | Name | Description |
---|---|---|
Action3<DataBuffer, System.String, System.Int32> | onSuccess | The callback to invoke on success. |
Action1<Exception> | onFailure | The callback to invoke on failure. |
Overrides
Send(DataBuffer, String, Int32)
Sends data synchronously.
Declaration
public override Error Send(DataBuffer buffer, string ipAddress, int port)
Parameters
Type | Name | Description |
---|---|---|
DataBuffer | buffer | The buffer. |
System.String | ipAddress | The remote IP address. |
System.Int32 | port | The remote port. |
Returns
Type | Description |
---|---|
Error |
Overrides
Events
OnSocketCreated
Raised when a socket has been created and initialized.
Declaration
public static event Action1<UdpSocket> OnSocketCreated
Event Type
Type | Description |
---|---|
Action1<UdpSocket> |