THttp:onnect
  

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

LOCAL 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

THttp:Get