Class TurnClient
Implements a TURN (Traversal Using Relays around NAT) client that manages relay allocations on a TURN server, peer permissions, channel bindings, and data relay between the client and peers.
public class TurnClient : IDisposable
- Inheritance
-
TurnClient
- Implements
- Inherited Members
Constructors
TurnClient()
Initializes a new instance of the TurnClient class.
public TurnClient()
Methods
BindingIndication()
Send binding indication to the server, no response will be received
public void BindingIndication()
BindingRequest()
Send binding request to the server, in order to receive response must subscribe to Bound event
public void BindingRequest()
Connect(TurnClientParameters)
Connects to a TURN server using the specified parameters, establishing a transport connection and starting the control thread.
public void Connect(TurnClientParameters parameters)
Parameters
parametersTurnClientParametersThe configuration parameters for the TURN client connection.
Exceptions
- InvalidOperationException
Thrown when the client is already connected.
- ArgumentException
Thrown when required parameters are missing or invalid.
Disconnect()
Disconnect from the server
public void Disconnect()
Dispose()
Disconnects from the TURN server and releases all resources.
public void Dispose()
Send(IPEndPoint, VersatileBuffer)
Send message to peer through server relay end point
public void Send(IPEndPoint peerEndPoint, VersatileBuffer data)
Parameters
peerEndPointIPEndPointPeer address
dataVersatileBufferData to send
Events
Bound
Fired when server responds to binding request, returns our server-reflexive address
public event EventHandler<IPEndPoint> Bound
Event Type
Connected
Fired when connected to the server, returns relay end point allocated by the server
public event EventHandler<TurnConnectedEventArgs> Connected
Event Type
Disconnected
Fired when disconnected from the server, returns error code
public event EventHandler Disconnected
Event Type
Received
Fired when message is received from peer via server relay
public event EventHandler<TurnReceivedEventArgs> Received