CRT Icon  Session Object


 

Description

The Session object provides access to the state and properties that exist for the current connection or session.

 

Syntax

session.property [ = expression ]

session.Method([arglist])

 

Remarks

CRT's Session object is accessed through the top-level objectÆs æSessionÆ property.

 

Session Object Properties and Methods

Properties

Methods

ááááConnected

ááááConnect

ááááLocalAddress

ááááDisconnect

ááááLogFileName

ááá Log

ááááRemoteAddress

ááááPrint

 

Properties

 

Connected

Description

Returns a boolean value indicating whether the current session is connected or not.

Syntax

object.Connected

Remarks

Boolean read-only property.

 

LocalAddress

Description

Returns the IP address of the local machine in the form of a string.

Syntax

object.LocalAddress

Remarks

LocalAddress is a read-only string property. The LocalAddress property should only be accessed if the session is connected. Attempting to access LocalAddress while not connected is an error.

 

LogFileName

Description

Returns or sets the name of the current log file.

Syntax

object.LogFileName [ = filename ]

Remarks

If filename is invalid a runtime error is generated. See also: session.Log

 

RemoteAddress

Description

Returns the IP address of the remote host in the form of a string.

Syntax

object.RemoteAddress

Remarks

RemoteAddress is a read-only string property. The RemoteAddress property should only be accessed if the session is connected. Attempting to access RemoteAddress while not connected is an error.

 

 

Methods

Connect

Description

Connects a session

Syntax

object.Connect arg

Remarks

The Connect method takes a string parameter that specifies how a connection is to be made. The format of the string parameter matches the format of the command line arguments to CRT.

 

Examples:

Connect using a pre-defined session:

crt.session.Connect("/s mysession")

 

Connect to æmyhostÆ on port 2345 using the telnet protocol and Default session parameters:

crt.session.Connect("/telnet myhost 2345")

 

Disconnect

Description

Disconnects the current session.

Syntax

object.Disconnect

Remarks

If the current session is not connected. Disconnect does nothing.

 

Log

Description

Enables or disables logging.

Syntax

object.Log(start[,append,[raw]])

Remarks

Starts or stops logging depending on the boolean state of the æstartÆ parameter. When logging is being started the optional boolean æappendÆ and ærawÆ parameters may be set to True to open the log file for appending or to log raw characters respectively. The append and raw parameters are optional and are false if not specified (When æstartÆ is false the values of append and raw are ignored).

 

Print

Description

Starts or stops autoprint.

Syntax

object.Print(start)

Remarks

Starts or stops autoprint depending on the boolean æstartÆ parameter.