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 Udp
Declaration
public UdpSocket(bool ipv6)
Parameters
Type | Name | Description |
---|---|---|
System. |
ipv6 | Whether an IPv6 socket should be created. |
UdpSocket(Boolean, Int32, Int32)
Initializes a new instance of the Udp
Declaration
public UdpSocket(bool ipv6, int sendBufferSize, int receiveBufferSize)
Parameters
Type | Name | Description |
---|---|---|
System. |
ipv6 | Whether an IPv6 socket should be created. |
System. |
sendBufferSize | The desired send buffer size. |
System. |
receiveBufferSize | The desired receive buffer size. |
Properties
AttemptIPv4Dscp
Attempt to use DSCP for IPv4 when possible. Default is false. You must "opt-in".
Declaration
public static bool AttemptIPv4Dscp { get; set; }
Property Value
Type | Description |
---|---|
System. |
AttemptIPv6Dscp
Attempt to use DSCP for IPv6 when possible. Default is false. You must "opt-in".
Declaration
public static bool AttemptIPv6Dscp { get; set; }
Property Value
Type | Description |
---|---|
System. |
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. |
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. |
DisableSocketIOControl
Gets or sets whether Socket.IOControl should be disabled.
Declaration
public static bool DisableSocketIOControl { get; set; }
Property Value
Type | Description |
---|---|
System. |
IPv6
Gets a value indicating whether the socket supports IPv6.
Declaration
public override bool IPv6 { get; }
Property Value
Type | Description |
---|---|
System. |
Overrides
IsClosed
Gets a value indicating whether this instance is closed.
Declaration
public override bool IsClosed { get; }
Property Value
Type | Description |
---|---|
System. |
Overrides
LocalIPAddress
Gets the local IP address.
Declaration
public override string LocalIPAddress { get; }
Property Value
Type | Description |
---|---|
System. |
Overrides
LocalPort
Gets the local port.
Declaration
public override int LocalPort { get; }
Property Value
Type | Description |
---|---|
System. |
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. |
Overrides
ReceiveBufferSize
Gets the current receive buffer size.
Declaration
public override int ReceiveBufferSize { get; }
Property Value
Type | Description |
---|---|
System. |
Overrides
ReceiveQueue
Gets the receive queue. For testing purposes only.
Declaration
public BitrateQueue ReceiveQueue { get; }
Property Value
Type | Description |
---|---|
Bitrate |
SendBufferSize
Gets the current send buffer size.
Declaration
public override int SendBufferSize { get; }
Property Value
Type | Description |
---|---|
System. |
Overrides
SendQueue
Gets the send queue. For testing purposes only.
Declaration
public BitrateQueue SendQueue { get; }
Property Value
Type | Description |
---|---|
Bitrate |
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. |
ipAddress | The local IP address. |
System. |
port | The local port. |
System. |
addressInUse | Indicates that access to the address is forbidden or in use. |
Returns
Type | Description |
---|---|
System. |
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<Data |
callback | The callback. |
Data |
buffer | The buffer. |
System. |
ipAddress | The IP address. |
System. |
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<Data |
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 |
---|---|---|
Data |
buffer | The buffer. |
System. |
ipAddress | The remote IP address. |
System. |
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