GetConnectedState Method
Class: FTP_SERVICE
Description:Returns the current type of internet connection
Returns the current type of internet connection.
=
Object.GetConnectedState
()
Return value Integer
Current Connection Type.
ValueDescription
INTERNET_CONNECTION_MODEMLocal system uses a modem to connect to the Internet.
INTERNET_CONNECTION_LANLocal system uses a local area network to connect to the Internet.
INTERNET_CONNECTION_PROXYLocal system uses a proxy server to connect to the Internet.
INTERNET_CONNECTION_MODEM_BUSYNo longer used.
INTERNET_RAS_INSTALLEDLocal system has RAS installed.
INTERNET_CONNECTION_OFFLINELocal system is in offline mode.
INTERNET_CONNECTION_CONFIGUREDLocal system has a valid connection to the Internet, but it might or might not be currently connected.
Possibly other codes could be returned. Assumed from MSDN.
Example
LOCAL loFTP, liState,liCID SET PROCEDURE TO ftp.prg ADDITIVE loFTP=CREATEOBJECT('ftp_service') liState=loFTP.GetConnectedState() && Check Connected state IF liState=-1 ?loFTP.GetExtendedErrorCode(),loFTP.GetExtendedErrorMsg() ELSE IF BITTEST(liState,0) && INTERNET_CONNECTION_MODEM ?"Use modem" ENDIF IF BITTEST(liState,1) && INTERNET_CONNECTION_LAN ?"Use LAN" ENDIF IF BITTEST(liState,2) && INTERNET_CONNECTION_PROXY ?"Use proxy" ENDIF IF BITTEST(liState,3) && INTERNET_CONNECTION_MODEM_BUSY ?"Modem busy" ENDIF IF BITTEST(liState,4) && INTERNET_RAS_INSTALLED ?"RAS installed" ENDIF IF BITTEST(liState,5) && INTERNET_CONNECTION_OFFLINE ?"Offline mode" ENDIF IF BITTEST(liState,6) && INTERNET_CONNECTION_CONFIGURED ?"Valid connection, but not cennected" ENDIF ENDIF RELEASE PROCEDURE ftp.prg
See also
Expand/Collapse source code of procedure GetConnectedState Source Code
      LOCAL fResult, lnConnectionState
            
      IF This.LoadAPIFuncs() != ERROR_SUCCESS
         RETURN -1
      ENDIF
            
      lnConnectionState = 0
        
      =This.BeforeGetConnectedState()
      fResult = InternetGetConnectedState(@m.lnConnectionState, 0)
      =This.GetExtendedError()
      =This.AfterGetConnectedState(m.fResult,m.lnConnectionState)
      RETURN IIF(m.fResult = 0,-1,m.lnConnectionState)