TsgcUDPClient

TsgcUDPClient implements the UDP Client based on Indy library.

 

UDP it's a connection less protocol where there is no assurance that message sent arrive to the destination but opposite to TCP protocol, it's much faster.

 

1. Drop a TsgcUDPClient component onto the form

 

2. Set Host and Port (default is 80) to connect to an available UDP Server.


oClient := TsgcUDPClient.Create(nil);
oClient.Host := '127.0.0.1';
oClient.Port := 80;

3. You can connect through an HTTP Proxy Server, you need to define proxy properties:

 

    Host: proxy server hostname.

    Port: proxy server port number.

    Username: username for authentication, leave blank for anonymous.

    Password: password for authentication, leave blank for anonymous.

 

4. If you want, you can handle the events

 

    OnUDPRead: called when a new message is received from the server. The message is in Bytes format.

 

    OnUDPException: called when there is any exception in the UDP protocol.

 

    OnDTLSVerifyPeer: allows to verify if the peer's certificate is correct.

 

5. Call WriteData method to send any message to the UDP server.

 

 

Properties

    Host: IP or DNS name of the server.

 

    Port: Port used to connect to the host.

 

    LogFile: if enabled, saves socket messages to a log file (useful for debugging). The access to log file is not thread safe if it's accessed from several threads.

 

Enabled: if enabled every time a message is received and sent by socket it will be saved on a file.

 

FileName: full path to the filename.

 

UnMaskFrames: by default True, means that saves the websocket messages sent unmasked.

 

    NotifyEvents: defines which mode to notify WebSocket events.

 

neAsynchronous: this is the default mode, notify threaded events on asynchronous mode, adds events to a queue that are synchronized with the main thread asynchronously.

 

neSynchronous: if this mode is selected, notify threaded events on synchronous mode, needs to synchronize with the main thread to notify these events.

 

neNoSync: there is no synchronization with the main thread, if you need to access to controls that are not thread-safe, you need to implement your own synchronization methods.

 

    Proxy: here you can define if you want to connect through a Proxy Server, you can connect to the following proxy servers:

pxyHTTP: HTTP Proxy Server.

pxySocks4: SOCKS4 Proxy Server.

pxySocks4A: SOCKS4A Proxy Server.

pxySocks5: SOCKS5 Proxy Server.

 

    DTLSOptions: if DTLS property is enabled, here you can customize some DTLS options (*DTLS is only supported on Enterprise Edition).

RootCertFile: path to root certificate file.

CertFile: path to certificate file.

KeyFile: path to certificate key file.

VerifyCertificate: if certificate must be verified, enable this property.

VerifyDepth: is an Integer property that represents the maximum number of links permitted when verification is

OpenSSL_Options: configuration of the openSSL libraries.

APIVersion: allows defining which OpenSSL API will be used. only openSSL API 1.1+ supports DTLS.

oslAPI_1_1: uses API 1.1 OpenSSL, requires our custom Indy library and allows using OpenSSL 1.1.1 libraries (with TLS 1.3 support).

oslAPI_3_0: uses API 3.0 OpenSSL, requires our custom Indy library and allows using OpenSSL 3.0.0 libraries (with TLS 1.3 support).

LibPath: here you can configure where are located the openSSL libraries

oslpNone: this is the default, the openSSL libraries should be in the same folder where is the binary or in a known path.

oslpDefaultFolder: sets automatically the openSSL path where the libraries should be located for all IDE personalities.

oslpCustomFolder: if this is the option selected, define the full path in the property LibPathCustom.

LibPathCustom: when LibPath = oslpCustomFolder define here the full path where are located the openSSL libraries.

UnixSymLinks: enable or disable the loading of SymLinks under Unix systems (by default is enabled, except under OSX64):

oslsSymLinksDefault: by default are enabled except under OSX64 (after MacOS Monterey fails trying to load the library without version.).

oslsSymLinksLoadFirst: Load SymLinks and do before trying to load the version libraries.

oslsSymLinksLoad: Load SymLinks after trying to load the version libraries.

oslsSymLinksDontLoad: don't load the SymLinks.