Command IT_SetProxy

4D Internet Commands

IT_SetProxy

version 6.8.1 (Modified)


IT_SetProxy (protocol; proxyKind; proxyHostName; proxyPort; proxyUserID) Integer

ParameterTypeDescription
protocolInteger1 = FTP; 2 = SMTP; 3 = POP3; 4 = IMAP
proxyKindInteger0 = None; 1 = SOCKS
proxyHostNameStringHost name or IP address of the SOCKS Proxy
proxyPortIntegerProxy port to connect to
proxyUserIDTextUserID for SOCKS

Function result Integer Error Code

Description

The IT_SetProxy command allows you to negociate a connection using the specified protocol and then send all further requests through the SOCKs Host (SOCKS Proxy). If you are just connecting to an intranet, then you will probably not have to communicate through the SOCKS Host. However, it all depends on how your company has their firewall set up. The IT_SetProxy settings have an interprocess scope and effect all the connections using the specified protocol in any 4D process.

Note: Socks (or "SOCKS") is a protocol that a proxy server can use to accept requests from client users in a company's network so that it can forward them across the Internet. If your workstation is located behind a firewall and you want to access an information located on the Internet, the SOCKS host receives your request, forwards the request through the firewall, and then returns the information to your client application.

protocol is an integer value that specifies the protocol to be routed through the specified SOCKS Proxy host. A value of 1 will effect FTP protocol. A value of 2 will effect SMTP protocol. A value of 3 will effect POP3 protocol. A value of 4 will indicate IMAP protocol.

proxyKind is an integer value indicating whether the specified protocol should be routed through a SOCKS Proxy host or not. A value of 1 will route all requests for the specified protocol through the specified SOCKS Host. A value of zero won't route requests for the specified protocol through any SOCKS Host.

proxyHostName is the Host name or the IP address of the SOCKS Proxy machine.

proxyPort is an integer value that specifies the port to use for the specified protocol to communicate with the SOCKS Proxy host.

proxyUserID is a text value that identifies the user. The user ID is given by your network administrator. proxyUserID can be an empty text ("").

Example

Using the following method, all FTP connections will be routed through the specified SOCKS Proxy Host.

   $err:=IT_SetProxy (1;1;$proxyAdd;$proxyPort;"")    `FTP SOCKS Proxy
   $err:=FTP_Login ("ftp.4d.com";"anonymous";[email protected]";$ftpID)
   $err:=FTP_GetFileInfo ($ftpID;$vpath;$vsize;$vmodDate)
   $err:=FTP_Receive ($ftpID;$vpath;"";0)
   $err:=FTP_Logout ($ftpID)

Note: For clarification purposes, this example does not contain error checking.

The following statement stops routing FTP connections through any SOCKS Proxy Host.

   $err:=IT_SetProxy (1;0;$proxyAdd;$proxyPort;"")

See Also

IT_GetProxy.