IT_PPPStatus

4D - Documentation   Français   English   German   Japanese   4D Internet Commands, Theme List   4D Internet Commands, Alphabetical List   Back   Previous   Next

version 6.8.1


IT_PPPStatus {(pppProfil)} Integer

ParameterTypeDescription
pppProfilStringDial-up name = Null string on Mac OS,
optionally filled under Windows
Function resultInteger1 if connected; 0 if connecting; -1 if error

Description

The IT_PPPStatus command allows you to check the status of a connection opened with the IT_PPPConnect command or opened manually.

pppProfil is a text value specifying which opened connection to check.

Under Windows, this parameter is optional but may be useful to ensure good running whatever the user network configuration.

Under Windows:

- If pppProfil is passed and valid, specified connection status is return.

- If pppProfil is not passed or is passed as a null string, IT_PPPStatus will return:

-1 if several connections are opened,

the status of the opened connection if only one connection is opened.

Under Mac OS:

This parameter is not taken into account.

IT_PPPStatus returns an integer denoting the connection status. It returns:

1 if connected,

0 if connecting,

-1 in case of a connection failure or if not connected.

Example

      `Method GetMessages (this method is executed in a process)
   If(mPPPConnect($vPPPProfil; 120))
      $vErrCode:=IT_MacTCPInit 
      If($vErrCode=0)
         $vErrCode:=POP3_Login...
         ...
      Else
         ALERT("Connection failed")
      End if
   End if

      `Method mPPPConnect
   C_BOOLEAN($0) `returns True if we are currently connected, False if connection failed
   C_TEXT($1) `null string if Mac OS, Entry Name if Windows
   C_INTEGER($2)  `timeout in seconds

   If (IT_PPPStatus =1)
      $0:=True  `we are already connected
   Else
      $vTimeoutLength:=$2
      $vTimeout:=False
      $vErr:=IT_PPPConnect($1)
      If($vErr=0)
         $vStart:=Current time
         Repeat
            DELAY PROCESS(Current process;30)
            $vStatus:=IT_PPPStatus($1)
            $vTimeout:=((Current time-$vStart)>$vTimeoutLength)
         Until (($vStatus=1) | $vTimeout) `we are connected or time out 
         If(Not($vTimeout)) 
            $0:=True `we are connected
         End if
      End if  `… $Err = 0
   End if

See Also

IT_PPPConnect, IT_PPPDisconnect.


4D - Documentation   Français   English   German   Japanese   4D Internet Commands, Theme List   4D Internet Commands, Alphabetical List   Back   Previous   Next