Hamster-Scripts: Functions (built-in)

RAS

RasGetConnection

Returns the name (phonebook-entry) of current RAS-connection.

Returns: Name of RAS-connection; "" if not connected.

print( RasGetConnection )

RasIsConnected

Checks current connection-state.

Returns: 1 (true) if connected, 0 (false) otherwise.

if( !RasIsConnected )
   # dial
endif

RasDial( <name>, <user>, <pass>, <connid> )

...
RasDial( <name> )

Dials the RAS-connection named "<name>" and tries to authenticate with username <user> and password <pass>. The connection-handle may optionally be saved in variable <connid>.

NOTE: This function does NOT support any of Hamster's password-options! You have to use the Hamster-specific functions "HamRasDial" and "HamRasHangup" if you want to use them!

Returns: 0: connected; >0: error-code; -1: RAS not installed

$try = 1
while( RasDial("MyProvider","MyUsername","MyPassword") != 0 )
   if( $try >= 3 )
      error( "Dialing failed!" )
   endif
   inc( $try )
   sleep( 10000 )
endwhile

RasHangup( <connid> )

RasHangup

Terminates an existing RAS-connection. If no specific <connid> is given, any current connection is terminated.

Returns: 0: OK; >0: error-code; -1: RAS not installed

RasHangup

RasGetIP

Returns dynamically assigned IP address of current RAS connection.

Returns: IP as string; empty string if not connected.

print( RasGetIP )

See also: ListRasEntries

 

[www.elbiah.de Hamster Playground Documentation]