RUDPServer Component
Properties Methods Events Configuration Settings Errors
The RUDPServer component is a Reliable UDP server based on an asynchronous, event-driven architecture. It is designed to balance the load between connections for a fast, powerful server.
Syntax
nsoftware.IPWorksP2P.Rudpserver
Remarks
The RUDPServer component implements a Reliable UDP server based on RFC 908. Use of RUDPServer guarantees that data is delivered to the remote host using UDP as a transport mechanism.
RUDPServer is the server complement of RUDPClient (which is used to create client applications). They share a common design philosophy and interface. We expect you will find RUDPServer as easy to use as RUDPClient.
The connections are identified by a ConnectionId, an id generated by the component to identify each connection. This id is unique to each connection. RUDPServer's events also have ConnectionId as a parameter to identify the connection to which they relate.
Our main goal in designing RUDPServer was to make it easy to use without sacrificing performance. The component has a minimum of properties, and events.
RUDPServer can start to listen on a port by setting the Listening
property to True. When a remote host asks for a connection, the ConnectionRequest event is
fired. At that point, the connection can either be accepted or rejected. If
the connection is accepted, a ConnectionId is assigned, and communication can
start. From this point on, the operation is very similar to RUDPClient. Data is
sent by assigning the data string to the DataToSend field. The address
and port of the incoming connection can be found by querying the RemoteHost
and RemotePort fields.
Rudpserver server = new Rudpserver(); server.OnDataIn += (s,e) => { //The DataIn event fires when data is received. Console.WriteLine("Server Received: " + e.Text); //Echo text back server.Connections[e.ConnectionId].DataToSend = e.Text; }; server.LocalPort = 4444; server.Listening = true; Rudpclient client = new Rudpclient(); client.OnDataIn += (s, e) => { //The DataIn event fires when data is received. Console.WriteLine("Client Received: " + e.Text); }; client.Connect("localhost", 4444); //Send data to the server client.DataToSend = "Hello World!";
Property List
The following is the full list of the properties of the component with short descriptions. Click on the links for further details.
ConnectionBacklog | The maximum number of pending connections. |
Connections | A collection of currently connected clients. |
DefaultTimeout | An initial timeout value to be used by incoming connections. |
EncryptingAlgorithm | Then encryption algorithm used when encrypting. |
EncryptionPassword | Then password to encrypt the connection. |
KeepAlive | When True, KeepAlive packets are enabled (for long connections). |
Linger | When set to True, connections are terminated gracefully. |
Listening | If True, the component accepts incoming connections on LocalPort. |
LocalHost | The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
LocalPort | The UDP port in the local host where the component listens. |
SSLAuthenticateClients | If true, the server asks the client(s) for a certificate. |
SSLCert | The certificate to be used during SSL negotiation. |
SSLEnabled | Whether TLS/SSL is enabled. |
TURNOAuthAccessToken | TBD.(The oauth access token in hex format). |
TURNOAuthSessionKey | TBD.(The oauth Session Key: mac_key in hex format). |
TURNPassword | TBD. |
TURNPort | TBD. |
TURNRelayedIP | TBD. |
TURNRelayedPort | TBD. |
TURNServer | TBD. |
TURNUser | TBD. |
Method List
The following is the full list of the methods of the component with short descriptions. Click on the links for further details.
AddTURNClient | Adds a peer client. |
Config | Sets or retrieves a configuration setting. |
Disconnect | Disconnect the specified client. |
DoEvents | Processes events from the internal message queue. |
Interrupt | Interrupts a synchronous send to the remote host. |
Send | Sends data to the remote host. |
SendFile | Send file to the remote host. |
SendKeepAlive | Sends a keep alive packet to the specified client. |
Shutdown | Shuts down the server. |
Event List
The following is the full list of the events fired by the component with short descriptions. Click on the links for further details.
Connected | Fired immediately after a connection completes (or fails). |
ConnectionRequest | Fired when a request for connection comes from a remote host. |
DataIn | Fired when data comes in. |
Disconnected | Fired when a connection is closed. |
Error | Information about errors during data delivery. |
ReadyToSend | Fired when the component is ready to send data. |
SSLClientAuthentication | Fired when the client presents its credentials to the server. |
SSLConnectionRequest | TBD. (It only be valid when UseInternalSecurityAPI=true). |
SSLStatus | Shows the progress of the secure connection. |
Status | Fires with information about the operation. |
Configuration Settings
The following is a list of configuration settings for the component with short descriptions. Click on the links for further details.
CloseStreamAfterTransfer | If true, the component will close the upload or download stream after the transfer. |
DefaultMaxIncomingOutstandingCount | The maximum number of outstanding segments. |
DefaultMaxIncomingSegmentSize | The maximum segment size in bytes. |
DefaultSequencedDelivery | Whether the connection uses sequenced delivery. |
KeepAliveInterval | The retry interval, in seconds, to be used when a keep-alive packet is sent and no response is received. |
KeepAliveRetryCount | The number of times to retry sending the keep-alive packet when there is no response. |
KeepAliveTime | The inactivity time in seconds before a keep-alive packet is sent. |
LogOptions | The level of messages to log. |
MaxIncomingOutstandingCount | The maximum number of outstanding segments. |
MaxIncomingSegmentSize | The maximum segment size in bytes. |
MaxOutgoingOutstandingCount[index] | The maximum number of outstanding segments when sending to other party. |
MaxOutgoingSegmentSize[index] | The maximum segment size of the other party in bytes. |
MaxRetransmitCount | The maximum number of retransmission attempts. |
RetransmitTimeout | The timeout in milliseconds between retransmit attempts. |
SequencedDelivery | Whether the connection uses sequenced delivery. |
UseWorkerThread | Whether to use a background thread to process outstanding operations. |
CaptureIPPacketInfo | Used to capture the packet information. |
DestinationAddress | Used to get the destination address from the packet information. |
DontFragment | Used to set the Don't Fragment flag of outgoing packets. |
LocalHost | The name of the local host through which connections are initiated or accepted. |
LocalPort | The port in the local host where the component binds. |
MaxPacketSize | The maximum length of the packets that can be received. |
QOSDSCPValue | Used to specify an arbitrary QOS/DSCP setting (optional). |
QOSTrafficType | Used to specify QOS/DSCP settings (optional). |
ShareLocalPort | If set to True, allows more than one instance of the component to be active on the same local port. |
UseConnection | Determines whether to use a connected socket. |
UseIPv6 | Whether or not to use IPv6. |
AbsoluteTimeout | Determines whether timeouts are inactivity timeouts or absolute timeouts. |
FirewallData | Used to send extra data to the firewall. |
InBufferSize | The size in bytes of the incoming queue of the socket. |
OutBufferSize | The size in bytes of the outgoing queue of the socket. |
BuildInfo | Information about the product's build. |
GUIAvailable | Tells the component whether or not a message loop is available for processing events. |
LicenseInfo | Information about the current license. |
UseInternalSecurityAPI | Tells the component whether or not to use the system security libraries or an internal implementation. |