ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / Sockets
  • Recreating a socket
  • Using an address that is already in use
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Creates a secure socket according to the SSL protocol.
Example
// Create a server of SSL Sockets with a certificate
sSSLSocket is string = "sSSLSocket"
// Use the hash of the certificate, 
// "Numeric print" property in the manager of certificates
// (certmgr.msc)
IF NOT SocketCreateSSL(sSSLSocket, 5043, "9d a4 84 fc f6 62 92 90 9a 62 d4 " + ...
		"ca 65 fb 08 7e 06 45 of 24", CertificateHash) THEN
	Error(ErrorInfo())
	RETURN
ELSE
	Info("SSL server socket started")
	// Rest of the server socket ...
	// The socket must be closed at the end of the process
	SocketClose(sSSLSocket)
END
Syntax
<Result> = SocketCreateSSL(<Socket name> , <Port number> , <Certificate identifier> [, <SSL options> [, <Address> [, <Store name>]]])
<Result>: Boolean
  • True if the socket was created,
  • False otherwise. If an error occurs, you can get more details on the error with ErrorInfo.
<Socket name>: Character string
Name that will be given to the socket. This name will be used by all socket functions. Caution: The socket name is case sensitive.
<Port number>: Integer
Port number that will be given to the socket. This number must be between 5000 and 65000. This number is specified when client computers connect to the server. This connection is established using SocketConnectSSL.
<Certificate identifier>: Character string
Name or hash of the certificate to be uses (according to the specified <SSL Options>):
  • name of certificat if the CertificateName constant is used,
  • hash of certificate if the CertificateHash constant is used. Spaces are allowed in the hash algorithm. The hash of the certificate can be found in the "Digital Print" property in the certificate manager (certmgr.msc) of the computer, for example:
    "9d a4 84 fc f6 62 92 90 9a 62 d4 ca 65 fb 08 7e 06 45 de 24"
This certificate must have a private key, installed on the server. For more details, see How to create an SSL certificate?
<SSL options>: Optional combination of integer constants
Protocol and identification mode used:
ProtocolSSL2SSL2 protocol.
ProtocolSSL3SSL3 protocol.
ProtocolTLS1TLS1 protocol
ProtocolTLS1_1TLS 1.1 protocol
ProtocolTLS1_2TLS 1.2 protocol
ProtocolTLS1_3TLS 1.3 protocol
CertificateHash<Certificate identifier> corresponds to the certificate hash.
CertificateName<Certificate identifier> corresponds to the certificate name.

Combination used by default: ProtocolTLS1 + ProtocolTLS1_1 + ProtocolTLS1_2 + CertificateName.
<Address>: Optional character string
IP address on which the socket must be created on the current computer. If the current computer is associated with several IP addresses (or with several network cards), this parameter enables you to choose the IP address that will be associated with the socket.
This IP address can have the following format:
  • IP address in XXX.XXX.XXX.XXX format (e.g. 125.5.110.100).
  • IP address containing the server name (e.g. www.windev.com). This syntax is recommended.
WINDEVWEBDEV - Server code The IP address is also returned by NetIPAddress.
<Store name>: Optional character string or optional constant
Subscription-exclusive new feature
Name of the store in which to search for certificates. This parameter can correspond to:
  • a string,
  • one of the following constants:
    certAuthorityCertification authority store.
    certTrustTrusted store.
    certPersonal
    (Default value)
    Personal store.
    certRootRoot store
    Note: These constants cannot be combined.

Note: This feature is only available in subscription-based versions, starting with WINDEV Suite 2025 - Update 3.
For more details, see Using new features exclusive to the subscription-based version of WINDEV Suite 2025.
Remarks

Recreating a socket

If a socket is not closed properly by SocketClose (e.g. if the computer is restarted), recreating the socket may take quite long. You will have to wait for the system to release the socket.

Using an address that is already in use

By default, SocketCreateSSL allows you to use an address that is already used by the same application or by another application. To change this mode, write the following line of code:
Socket.Option = SocketNoReuseAddress
Note: This option also indicates whether an address or port is already in use. In this case, SocketCreateSSL returns an error.
Business / UI classification: Business Logic
Component: wd300com.dll
Minimum version required
  • Version 12
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/05/2025

Send a report | Local help