RUDPClient Class
Properties Methods Events Configuration Settings Errors
The RUDPClient class is a Reliable UDP client based on an asynchronous, event-driven architecture.
Syntax
ipworksp2p.Rudpclient
Remarks
The RUDPClient class implements a Reliable UDP client based on RFC 908. Use of RUDPClient guarantees that data is delivered to the remote host using UDP as a transport mechanism.
Our main goal in designing RUDPClient was ease of use. The class has a minimum of properties and events.
The connection is attempted by calling the Connect method or setting the Connected property to True, and then waiting for the Connected event. The destination is defined by setting RemoteHost and RemotePort. Data is sent by calling the Send method with Text as a parameter, or by assigning the data string to the DataToSend property.
To disconnect, call the Disconnect method or set the Connected property to False. The Linger property controls how the connection is terminated.
The operation of the class is can be synchronous or asynchronous depending on the value of Timeout.
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 class with short descriptions. Click on the links for further details.
AcceptData | Enables or disables data reception (the DataIn event). |
BytesSent | The number of bytes actually sent after an assignment to DataToSend . |
Connected | Triggers a connection or disconnection. |
DataToSend | A string of data to be sent to the remote host. |
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. |
LocalHost | The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
LocalPort | The port in the local host to which the class binds. |
RemoteHost | The address of the remote host. Domain names are resolved to IP addresses. |
RemotePort | The UDP port in the remote host. |
SSLAcceptServerCert | Instructs the class to unconditionally accept the server certificate that matches the supplied certificate. |
SSLCert | The certificate to be used during SSL negotiation. |
SSLEnabled | Whether TLS/SSL is enabled. |
SSLServerCert | The server certificate for the last established connection. |
Timeout | A timeout for the class. |
Method List
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
Config | Sets or retrieves a configuration setting. |
Connect | Connects to a remote host. |
Disconnect | Disconnects from the remote host. |
DoEvents | Processes events from the internal message queue. |
Interrupt | Interrupts the current action. |
Send | Sends data to the remote host. |
SendFile | Sends file to the remote host. |
SendKeepAlive | Sends a keepalive packet. |
SetReceiveStream | Sets the stream to which received data will be written. |
SetSendStream | Reads content from the stream and sends it to the server. |
Event List
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
Connected | Fired immediately after a connection completes. |
ConnectionStatus | Fired to indicate changes in connection state. |
DataIn | Fired when data comes in. |
Disconnected | Fired when a connection is closed. |
Error | Information about errors during data delivery. |
ReadyToSend | Fired when the class is ready to send data. |
SSLServerAuthentication | Fired after the server presents its certificate to the client. |
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 class with short descriptions. Click on the links for further details.
CloseStreamAfterTransfer | If true, the class will close the upload or download stream after the transfer. |
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 | The maximum number of outstanding segments when sending to other party. |
MaxOutgoingSegmentSize | 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 class 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 class 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 class whether or not a message loop is available for processing events. |
LicenseInfo | Information about the current license. |
UseDaemonThreads | Whether threads created by the class are daemon threads. |
UseInternalSecurityAPI | Tells the class whether or not to use the system security libraries or an internal implementation. |