Class SIPUDPChannel
Class for managing a SIP connection using the UDP transport protocol.
Inherited Members
Namespace: SipLib.Channels
Assembly: SipLib.dll
Syntax
public class SIPUDPChannel : SIPChannel
Constructors
| Edit this page View SourceSIPUDPChannel(IPEndPoint, string?, AcceptConnectionDelegate?)
Constructs a new SIPUDPChannel.
Declaration
public SIPUDPChannel(IPEndPoint localIPEndPoint, string? User = null, AcceptConnectionDelegate? acceptConnection = null)
Parameters
Type | Name | Description |
---|---|---|
IPEndPoint | localIPEndPoint | Local IPEndpoint to listen on. |
string | User | Specifies the User part of the SIPURI for the local contact URI. This parameter is optional and defaults to null. |
AcceptConnectionDelegate | acceptConnection | User provided callback function that can determine whether or not to accept a network connection based on the client's IPEndPoint and the protocol type. Defaults to null. |
Methods
| Edit this page View SourceClose()
Closes the UDP client.
Declaration
public override void Close()
Overrides
| Edit this page View SourceDisableConnectionReset(UdpClient)
Performs a IOControl call to disable SocketExceptions that occur when ICMP port unreachable messages occur if the remote client is not listening on its port. This method can be called if the platform is Windows.
Declaration
public static void DisableConnectionReset(UdpClient Client)
Parameters
Type | Name | Description |
---|---|---|
UdpClient | Client | UdpClient to disable SocketExceptions on. |
Remarks
The SocketExceptions only occur on Windows.
See the first answer at: https://stackoverflow.com/questions/5199026/c-sharp-async-udp-listener-socketexception
See also: https://microsoft.public.win32.programmer.networks.narkive.com/RlxW2V6m/udp-comms-and-connection-reset-problem
GetConnectionsList()
Not used for UDP.
Declaration
protected override Dictionary<string, SIPConnection> GetConnectionsList()
Returns
Type | Description |
---|---|
Dictionary<string, SIPConnection> | Returns an empty Dictionary object for UDP because UDP is not a connected transport protocol. |
Overrides
| Edit this page View SourceIsConnectionEstablished(IPEndPoint)
Gets the connection status.
Declaration
public override bool IsConnectionEstablished(IPEndPoint remoteEndPoint)
Parameters
Type | Name | Description |
---|---|---|
IPEndPoint | remoteEndPoint | Endpoint to test. |
Returns
Type | Description |
---|---|
bool | Always returns true for UDP because UDP is not a connected transport protocol. |
Overrides
| Edit this page View SourceSend(IPEndPoint, byte[])
Sends a byte array
Declaration
public override void Send(IPEndPoint destinationEndPoint, byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
IPEndPoint | destinationEndPoint | IPEndPoint to send the message to. |
byte[] | buffer | Message to send. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if the SIP message is longer than that allowed by UDP |
Send(IPEndPoint, byte[], string?)
Sends a byte array.
Declaration
public override void Send(IPEndPoint dstEndPoint, byte[] buffer, string? serverCertificateName)
Parameters
Type | Name | Description |
---|---|---|
IPEndPoint | dstEndPoint | IPEndPoint to send the message to. |
byte[] | buffer | Message to send. |
string | serverCertificateName | Not used. May be null. |
Overrides
| Edit this page View SourceSend(IPEndPoint, string)
Sends a string message.
Declaration
public override void Send(IPEndPoint destinationEndPoint, string message)
Parameters
Type | Name | Description |
---|---|---|
IPEndPoint | destinationEndPoint | IPEndPoint to send the message to. |
string | message | Input message to send. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if the SIP message is longer than that allowed by UDP |