Indy

Indy library is an open source client/server communications library that supports TCP/UDP/RAW sockets, as well as over 100 higher level protocols including SMTP, POP3, IMAP, NNTP, HTTP, FTP, and many more. Indy is written in Delphi but is also available for C++Builder and FreePascal. sgcWebSockets uses Indy as a base for some components and the different sgcWebSockets Editions make a different use of the Indy library.

 

sgcWebSockets supports protocols like HTTP/2 which require the use of ALPN, can use TLS 1.3 using openSSL 1.1.1 or openSSL 3.0.0... all these features are not supported by standard Indy library, so sgcWebSockets Enterprise edition includes a custom Indy library which supports this features. To avoid uninstall the standard Indy library from the IDE, the required Indy files are renamed adding the prefix "sgc", so for example: the unit "IdGlobal" is renamed to "sgcIdGlobal". This way, both versions can coexist without problems.

 

Find below which Indy version is used by every sgcWebSockets Edition:

 

sgcWebSockets Edition Indy Version
STANDARD Standard
PROFESSIONAL Standard
ENTERPRISE Custom

 

Customers with a "Registered" licenses, are old licenses before the sgcWebSockets package was splitted, will find the following sgcWebSockets package versions:

 

sgcWebSockets Edition Indy Version
sgcWebSockets Standard
sgcWebSockets min Standard
sgcWebSockets min Indy* Custom

 

*The sgcWebSockets_min_indy is the same that sgcWebSockets Enterprise edition.

 

The use of the custom indy version, is defined in the file "sgcVer.inc" located in the source folder. There is a compiler define called "SGC_CUSTOM_INDY" which enables or disables the use of this indy version. If you have a Enterprise Edition and want to disable the use of the custom indy, just delete the following compiler define:

 

{$DEFINE SGC_CUSTOM_INDY}

 

Of course, if you enable SGC_CUSTOM_INDY but you don't have in the source folder the required custom indy version units, this compiler define won't work.

 

sgcIndy package

The use of the custom indy version is not limited to the sgcWebSockets components. Some customers want to make use of the new features of this custom indy version, in standard Indy components like SMTP for example, so they use TLS 1.3 when sending emails, using FTP servers... The sgcWebSockets Enterprise edition, provides an additional full Indy package with all these features. This package, called "sgcIndy package", includes the full Indy library with support for openSSL 1.1.1 and openSSL 3.0.0. So you first must uninstall your current Indy library installed in your IDE and then install this version, the process to install the sgcIndy package it's exactly the same that any Indy library (here the units are not renamed).

 

When you want to use openSSL libraries, just set the global variable OPENSSL_API_VERSION to the desired opensSSL API Version before loading openSSL libraries. This global variable is in the unit IdSSLOpenSSLHeaders.

 

Example: to use the openSSL 1.1.1 libraries

 

OPENSSL_API_VERSION := opSSL_1_1;

 

 

How to use a Single sgcIndy package

When using sgcWebSockets Enterprise and sgcIndy package in a same application, the sources maybe duplicated because the sgcWebSockets Enterprise version uses a custom indy version with the Indy units renamed, this means that for example units like sgcIdGlobal.pas and IdGlobal.pas will be compiled in the same application (the first is used when using any component of the sgcWebSockets Enterprise package and the second when using any component of the sgcIndy package, like ftp, smtp...).

 

To avoid this behaviour, the sgcWebSockets package can be configured to use the sgcIndy installed version and still make use of all the components. To do this, follow the instructions below:

 

1. Open the file sgcVer.inc, it's located in the folder Source of the sgcWebsockes package.

2. Disable the compiler directive: SGC_CUSTOM_INDY. This option tells the compiler, the files that start with sgcId*.pas exist and must be used when compiling the sgcWebSockets Enterprise Package.

3. Enable the following compiler: SGC_INDY_LIB. This options tells the compiler, the sgcIndy package is installed and must be used when compiling the package

 

{$DEFINE SGC_INDY_LIB}

 

Using the previous configuration, the sgcWebSockets Enterprise package will use the sgcIndy package that is installed and all the features that make use of this package (like http/2, IOCP, openSSL 3.0...) will be enabled.