ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Communication / Sockets
  • Overview
  • How to use the SOCKS5 protocol with WINDEV, WEBDEV and WINDEV Mobile?
  • Proxy function
  • FTPProxy
  • SocketProxy
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Overview
SOCKS5 is a simple network protocol intended to standardize the use of proxies for applications. After a short transaction phase between the application and the SOCKS5 proxy server, the application can seamlessly exchange data over the socket.
How to use the SOCKS5 protocol with WINDEV, WEBDEV and WINDEV Mobile?
There are several functions that allow you to configure the use of a proxy via the SOCKS5 protocol:

Proxy function

To use the SOCKS5 protocol with Proxy, simply prefix the name of the proxy server with "socks5://" and use the function with the standard syntax (passing the port and the identifiers).
CAUTION:
  • A SOCKS5 proxy cannot be used if HTTP is configured to use WinInet (mode that uses Internet Explorer). This mode can be configured with the httpConfigureMode constant of HTTPConfigure.
  • Calling HTTPRequest and HTTPSendForm with a proxy that uses SOCKS5 will force the use of the cURL command.
    Therefore, it is recommended to use a variable of type httpRequest with a SOCKS5 proxy.
Example:
// On ne doit pas utiliser wininet pour avoir accès au proxy SOCKS5
HTTPConfigure(httpConfigureMode, 1)
// Les fonctions suivantes utiliseront le proxy SOCKS5 
// à l'adresse 172.12.2.79:1080 avec les identifiants USER:PWD 
Proxy("socks5://172.12.2.79", 1080, "USER", "PWD")
req is httpRequest
req.URL = "https://www.google.fr"
rep is httpResponse = req.Send()
IF ErrorOccurred THEN
	Error(ErrorInfo(errFullDetails))
ELSE
	Info("OK")
END
Proxy("")

FTPProxy

To use the SOCKS5 protocol with FTPProxy, use the ftpProxySOCKS5 constant to specify the type of proxy to be used.
CAUTION:
  • A SOCKS5 proxy cannot be used if FTP is configured to use WinInet (mode that uses Internet Explorer). This mode can be configured with the httpConfigureMode constant of FTPConfigure. Calling FTPProxy will cause a fatal error.
  • SOCKS5 proxies can only be used with FTP and SFTP. If a SOCKS5 proxy is configured, calling FTPConnect on a server via FTPES or FTPIS will cause a fatal error.
Example:
// On ne doit pas utiliser wininet pour avoir accès au proxy SOCKS5
FTPConfigure(ftpConfigureMode, 1)
// Les fonctions FTP utiliseront le proxy SOCKS5 
// à l'adresse 172.12.2.79:1080 avec les identifiants USER:PWD 
FTPProxy(ftpProxySOCKS5, "172.12.2.79",1080, "USER", "PWD")
// On se connecte au serveur FTP de test de rebex
nIDFTP is int = FTPConnect("ftp://test.rebex.net/", "demo", "password", 21)
IF nIDFTP = -1 THEN
	Error(ErrorInfo(errFullDetails))
ELSE
	Info("OK")
END
FTPDisconnect(nIDFTP)
// On enlève le proxy
FTPProxy(ftpProxyNone)

SocketProxy

SocketProxy allows you to specify whether TCP sockets and WebSockets must go through a SOCKS5 proxy to execute their requests.
// Infos du proxy SOCKS5
SocketProxy("socks5://172.17.2.79",1080,"USER","PWD")

// Connexion au serveur en passant par le proxy
IF NOT SocketConnect("tcp_via_socks5", 4242, "172.19.5.80") THEN
	Error(ErrorInfo(errFullDetails))
ELSE
	// Opérations d'écriture et de lecture (comme d'habitude)
	Info("OK")
	SocketWrite("tcp_via_socks5", "écho")
	s is Buffer = SocketRead("tcp_via_socks5")
	Trace(BufferToHexa(s))
	SocketClose("tcp_via_socks5")
END

// Suppression du proxy pour les sockets
SocketProxy("")
Minimum version required
  • Version 28
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/28/2025

Send a report | Local help