Flynet Viewer .NET Programmer's Reference

sessionMonitor Property (boolean)

sessionMonitor Property (boolean)

Previous topic Next topic  

sessionMonitor Property (boolean)

Previous topic Next topic  

 

Control the connection monitoring mode.

 

NOTE: this is a part of a direct API monitor function which can easily be confused with the HostScreen.requestMonitorConnection, HostScreen.closeMonitorConnection and other HostScreen monitor requests.

 

These two are different types of calls--the sessionMonitor, for example, is used by the web terminal emulation solution to support an AJAX terminal update thread, while the HostScreen.requestMonitorConnection is for testing a higher-level application session using the provided Viewer Monitor application.

 

HostConnection.sessionMonitor

 

Arguments

 

HostConnection

 Required. HostConnection object.

 

Remarks

 

READWRITE.

 

Set to true before establishing a connection in order to monitor the connection. Use in conjunction with the HostScreen object's waitForUpdate method to monitor any changes.

 

Use this property to monitor screen changes in a session in an environment where multiple threads may access the same session. Typically, one thread would be responsible for sending keystrokes to the screen while another monitors. When an update or timeout occurs the monitoring thread will report the event back.

 

The following c# example shows a class with a constructor and two methods. The constructor handles the initial connection. The first method monitors the session and returns information about any screen changes. The second method sends keystrokes to the host session. The sending of keystrokes is what normally results in screen transitions which the monitoring function would report back on.

 

using System;

using FSCProLib;

 

public class SampleMonitor

{

 public string sessionKey;

 public string updateFlag;

 public int writeCount;

 

 public SampleMonitor()

 {

         // Connect to the host and return the sessionKey

         HostConnection oConn = new HostConnection();

         // Create the connection

         oConn.hostName = "Insure";

         oConn.connect();

         this.sessionKey = oConn.sessionKey;

         oConn.disconnect("reserve");

 }

 

 public bool Monitor(int timeOut)

 {

         HostConnection oConn = new HostConnection();

         oConn.sessionMonitor = true;

         oConn.sessionKey = this.sessionKey;

         oConn.connect();

         HostScreen oScreen = oConn.getScreen();

         bool updated = oScreen.waitForUpdate(timeOut);

         this.writeCount = oScreen.hostWriteCount;

         this.updateFlag = oScreen.waitForUpdateFlag;

         return updated;

 }

 

 public bool SendKeys(string keys)

 {

         try

         {

                 HostConnection oConn = new HostConnection();

                 oConn.sessionKey = this.sessionKey;

                 oConn.quickSend(keys);

                 return true;

         }

         catch (System.Exception)

         {

                 return false;

         }

 }

}

 

 

Requirements

 

Flynet Viewer

 

See Also

 

connect | waitForUpdate | waitForUpdateFlag

 

Applies To: HostConnection object

 


© 2016 Inventu Corporation, Flynet LTD