PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Re-creating a socket
  • Re-using an address that is already used
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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 process
SocketClose(sSSLSocket)
END
Syntax
<Result> = SocketCreateSSL(<Socket Name> , <Port Number> , <Certificate Identifier> [, <SSL Options> [, <Address>]])
<Result>: Boolean
  • True if the socket was created,
  • False otherwise. To find out the error details, use ErrorInfo.
<Socket Name>: Character string (with quotes)
Name that will be given to the socket. This name will be used by all the 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 included between 5000 and 65000. This number will be specified when the client computers are connected to the server. This connection will be established by SocketConnectSSL.
<Certificate Identifier>: Character string (with quotes)
Name or hash of certificate to use (according to the specified <SSL Options>):
  • name of certificat if the CertificateName constant is used,
  • hash of certificate if the CertificateHash constant is used. The space characters are allowed in the Hash. 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. See How to create an SSL certificate? for more details
<SSL Options>: Optional combination of integer constants
Protocol and identification mode used:
ProtocolSSL2The SSL2 protocol is used
ProtocolSSL3The SSL3 protocol is used
ProtocolTLS1
(default value)
The TLS1 protocol is used
CertificateHash<Certificate Identifier> corresponds to the hash of certificate.
CertificateName
(Default value)
<Certificate Identifier> corresponds to the name of certificate.
The options used by default are: ProtocolTLS1 + CertificateName.
<Address>: Optional character string (with quotes)
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 (125.5.110.100 for example).
  • IP address containing the name of the server (www.WINDEV.com for example). This syntax is recommended.
WINDEVWEBDEV - Server code The IP address is also returned by NetIPAddress.
Remarks

Re-creating a socket

If a socket is not closed properly by SocketClose (restarting the computer for example), re-creating the socket may take quite a long time. Indeed, you will have to wait until the socket is freed by the system.

Re-using an address that is already used

By default, SocketCreateSSL allows you to re-use an address that is already used (by the application itself or by another application). To forbid this operating mode, type the following code line:
Socket.Option = SocketNoReuseAddress
Note: This option also allows you to find out whether an address or a port is already used. In this case, SocketCreateSSL returns an error.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230com.dll
Windows Mobile wp230com.dll
Minimum required version
  • Version 12
This page is also available for…
Comments
Click [Add] to post a comment