ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WINDEV, WEBDEV and WINDEV Mobile 28 feature!
  • Overview
  • How to use the SOCKS5 protocol with WINDEV, WEBDEV and WINDEV Mobile?
  • Proxy
  • FTPProxy
  • SocketProxy
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
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

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 httpParameterMode constant of HTTPParameter.
  • 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:
// Do not use WinInet to access the SOCKS5 proxy
HTTPParameter(httpParameterMode, 1)
// The following functions will use the SOCKS5 proxy
// at address 172.12.2.79:1080 with the identifiers USER:PWD
Proxy("socks5://172.12.2.79", 1080, "USER", "PWD")
req is httpRequest
req.URL = "https://www.google.com"
req 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 httpParameterMode constant of FTPParameter. 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:
// Do not use WinInet to access the SOCKS5 proxy
FTPParameter(ftpParameterMode, 1)
// FTP functions will use the SOCKS5 proxy
// at address 172.12.2.79:1080 with the identifiers USER:PWD
FTPProxy(ftpProxySOCKS5, "172.12.2.79",1080, "USER", "PWD")
// Connect to ftp://test.rebex.net/
nFTPID is int = FTPConnect("ftp://test.rebex.net/", "demo", "password", 21)
IF nFTPID = -1 THEN
Error(ErrorInfo(errFullDetails))
ELSE
Info("OK")
END
FTPDisconnect(nFTPID)
// Remove proxy
FTPProxy(ftpProxyNone)

SocketProxy

SocketProxy allows you to specify whether TCP sockets and WebSockets must go through a SOCKS5 proxy to execute their requests.
// SOCKS5 proxy info
SocketProxy("socks5://172.17.2.79",1080,"USER","PWD")
 
// Connect to the server through the proxy
IF NOT SocketConnect("tcp_through_socks5", 4242, "172.19.5.80") THEN
Error(ErrorInfo(errFullDetails))
ELSE
// Write and read operations (as usual)
Info("OK")
SocketWrite("tcp_through_socks5", "echo")
s is Buffer = SocketRead("tcp_through_socks5")
Trace(BufferToHexa(s))
SocketClose("tcp_through_socks5")
END
 
// Remove proxy
SocketProxy("")
Minimum version required
  • Version 28
This page is also available for…
Comments
Click [Add] to post a comment