Class StunServer
A STUN server.
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class StunServer : Dynamic
Properties
CreateDatagramSocket
Gets or sets the create callback to create a datagram socket.
Declaration
public Function1<DatagramSocketCreateArgs, DatagramSocket> CreateDatagramSocket { get; set; }
Property Value
Type | Description |
---|---|
Function1<Datagram |
CreateStreamSocket
Gets or sets the create callback to create a stream socket.
Declaration
public Function1<StreamSocketCreateArgs, StreamSocket> CreateStreamSocket { get; set; }
Property Value
Type | Description |
---|---|
Function1<Stream |
DisableTcp
Gets or sets whether to prevent the server from listening for TCP requests.
Declaration
public bool DisableTcp { get; set; }
Property Value
Type | Description |
---|---|
System. |
DisableTls
Gets or sets whether to prevent the server from listening for TLS requests.
Declaration
public bool DisableTls { get; set; }
Property Value
Type | Description |
---|---|
System. |
DisableUdp
Gets or sets whether to prevent the server from listening for UDP requests.
Declaration
public bool DisableUdp { get; set; }
Property Value
Type | Description |
---|---|
System. |
Label
Gets the label.
Declaration
protected virtual string Label { get; }
Property Value
Type | Description |
---|---|
System. |
LocalTcpAddress
Gets the local TCP address.
Declaration
public ServerAddress LocalTcpAddress { get; }
Property Value
Type | Description |
---|---|
Server |
LocalTcpAddresses
Gets the local TCP addresses.
Declaration
public ServerAddress[] LocalTcpAddresses { get; }
Property Value
Type | Description |
---|---|
Server |
LocalUdpAddress
Gets the local UDP address.
Declaration
public ServerAddress LocalUdpAddress { get; }
Property Value
Type | Description |
---|---|
Server |
LocalUdpAddresses
Gets the local UDP addresses.
Declaration
public ServerAddress[] LocalUdpAddresses { get; }
Property Value
Type | Description |
---|---|
Server |
StreamSendTimeout
Gets or sets timeout for asynchronous data sending over stream sockets in ms. Defaults to unset.
Declaration
public int StreamSendTimeout { get; set; }
Property Value
Type | Description |
---|---|
System. |
TcpAddresses
Gets the TCP server addresses.
Declaration
public ServerAddress[] TcpAddresses { get; }
Property Value
Type | Description |
---|---|
Server |
TlsAddresses
Gets the TLS server addresses.
Declaration
public ServerAddress[] TlsAddresses { get; }
Property Value
Type | Description |
---|---|
Server |
UdpAddresses
Gets the UDP server addresses.
Declaration
public ServerAddress[] UdpAddresses { get; }
Property Value
Type | Description |
---|---|
Server |
Methods
CreateErrorResponse(Message, TransportAddress, String)
Creates an error response with a ganeric Stun server error.
Declaration
protected virtual Message CreateErrorResponse(Message request, TransportAddress remoteAddress, string errorMessage)
Parameters
Type | Name | Description |
---|---|---|
Message | request | The request. |
Transport |
remoteAddress | The remote address. |
System. |
errorMessage | The erro messager. |
Returns
Type | Description |
---|---|
Message |
CreateExceptionResponse(Message, TransportAddress, Error)
Creates an exception response.
Declaration
protected virtual Message CreateExceptionResponse(Message request, TransportAddress remoteAddress, Error error)
Parameters
Type | Name | Description |
---|---|---|
Message | request | The request. |
Transport |
remoteAddress | The remote address. |
Error | error | The Stun error. |
Returns
Type | Description |
---|---|
Message |
GetPrefix(Boolean, Boolean)
Gets a prefix.
Declaration
protected string GetPrefix(bool udp, bool secure)
Parameters
Type | Name | Description |
---|---|---|
System. |
udp | |
System. |
secure |
Returns
Type | Description |
---|---|
System. |
Process(Message, DatagramSocket, StreamSocket, ServerAddress, TransportAddress)
Processes the specified request.
Declaration
protected virtual Message Process(Message request, DatagramSocket udpServerSocket, StreamSocket tcpServerSocket, ServerAddress localAddress, TransportAddress remoteAddress)
Parameters
Type | Name | Description |
---|---|---|
Message | request | The request. |
Datagram |
udpServerSocket | The UDP server socket. |
Stream |
tcpServerSocket | The TCP server socket. |
Server |
localAddress | The local address. |
Transport |
remoteAddress | The remote address. |
Returns
Type | Description |
---|---|
Message |
ProcessBuffer(DataBuffer, DatagramSocket, StreamSocket, ServerAddress, TransportAddress, out Int32)
Processes the buffer.
Declaration
protected virtual bool ProcessBuffer(DataBuffer buffer, DatagramSocket udpServerSocket, StreamSocket tcpServerSocket, ServerAddress localAddress, TransportAddress remoteAddress, out int readLength)
Parameters
Type | Name | Description |
---|---|---|
Data |
buffer | The buffer. |
Datagram |
udpServerSocket | The UDP server socket. |
Stream |
tcpServerSocket | The TCP server socket. |
Server |
localAddress | The local address. |
Transport |
remoteAddress | The remote address. |
System. |
readLength | Length of the read. |
Returns
Type | Description |
---|---|
System. |
Start()
Starts the server.
Declaration
public bool Start()
Returns
Type | Description |
---|---|
System. |
Start(ServerAddress[])
Starts the server.
Declaration
public bool Start(ServerAddress[] udpAddresses)
Parameters
Type | Name | Description |
---|---|---|
Server |
udpAddresses | The UDP addresses to listen on. |
Returns
Type | Description |
---|---|
System. |
Start(ServerAddress[], ServerAddress[])
Starts the server.
Declaration
public bool Start(ServerAddress[] udpAddresses, ServerAddress[] tcpAddresses)
Parameters
Type | Name | Description |
---|---|---|
Server |
udpAddresses | The UDP addresses to listen on. |
Server |
tcpAddresses | The TCP addresses to listen on. |
Returns
Type | Description |
---|---|
System. |
Start(ServerAddress[], ServerAddress[], ServerAddress[])
Starts the server.
Declaration
public virtual bool Start(ServerAddress[] udpAddresses, ServerAddress[] tcpAddresses, ServerAddress[] tlsAddresses)
Parameters
Type | Name | Description |
---|---|---|
Server |
udpAddresses | The UDP addresses to listen on. |
Server |
tcpAddresses | The TCP addresses to listen on. |
Server |
tlsAddresses | The TLS addresses to listen on. |
Returns
Type | Description |
---|---|
System. |
Stop()
Stops the server.
Declaration
public virtual bool Stop()
Returns
Type | Description |
---|---|
System. |