THttp:Connect
|
![]() ![]() ![]() |
NAME
Connect - connect to a remote server
SYNOPSIS
Connect( cAddress, nPort )
PURPOSE
Connect to a remote server on cAddress and nPort
EXAMPLE
#include "common.ch"
*----------------------------------------------------
FUNCTION Main( cProxy, nProxyPort )
*----------------------------------------------------
local oSock, cRet
local cServer := "www.google.com" // "localhost" //
local nPort := 80 // 8080 //
DEFAULT nProxyPort TO "8080"
oSock := THttp():New()
if cProxy!=NIL
oSock:SetProxy( cProxy, VAL(nProxyPort) )
endif
? "Connect to " +cServer +":" +alltrim(str( nPort ))
if oSock:Connect( cServer, nPort )
? "Connected"
? "Get homepage"
? oSock:Get( "pippo:pluto@/" )
? "Close connection"
if oSock:Close()
? "Close successfull"
else
? "Error on close connection"
endif
else
? "Refused"
endif
RETURN NIL
SEE ALSO