AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Comunicación / Sockets
  • Overview
  • How to use the SOCKS5 protocol with WINDEV, WEBDEV and WINDEV Mobile?
  • Proxy function
  • FTPProxy
  • SocketProxy
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
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:
// Do not use WinInet to access the SOCKS5 proxy
HTTPConfigure(httpConfigureMode, 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 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:
// Do not use WinInet to access the SOCKS5 proxy
FTPConfigure(ftpConfigureMode, 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_via_socks5", "echo")
	s is Buffer = SocketRead("tcp_through_socks5")
	Trace(BufferToHexa(s))
	SocketClose("tcp_through_socks5")
END

// Remove proxy
SocketProxy("")
Versión mínima requerida
  • Versión 28
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 25/03/2025

Señalar un error o enviar una sugerencia | Ayuda local