Show/Hide Toolbars

Flynet Viewer Developer User Guide

Navigation: Getting Started

Disconnecting from a host

Scroll Prev Top Next More

 

There are three disconnect options:

1.Stop
2.Reserve
3.Release

 

 

1.Stop

 

The first option is to stop the session. The following example demonstrates a simple connect and disconnect, stopping the session.

 

 

 

 

2.Reserve

 

The reserve option disconnects the HostConnection object from the session, but the session remains connected to the host. In order to reconnect to the session two criteria have to met:

1.The HostConnection object attempting to reconnect to the session must be running in the same process as the object that created the session.
2.The HostConnection object reconnecting to the session must be provided with the SessionKey of the session to connect to.

 

The following example demonstrates how the reserve option can be used.

 

 

 

 

In this example two HostConnection objects are created. The first creates the session, stores the SessionKey, and then disconnects - reserving the session. The second HostConnection object uses the SessionKey to connect to the session, and then it disconnects - stopping the session.

 

The second HostConnection met the two criteria and so was able to reconnect to the session:

It used the sessions SessionKey.

It runs in the same process as the first HostConnection object.

 

Note that for a IIS web application if the session were reserved and the SessionKey value was passed to another ASP page (within the same web application), reconnection to the session would be possible, as both the ASP pages would run in the same IIS application process.

 

 

3.Release

 

The final type of session handling is used return the session back to a pool (i.e. session pooling). If a HostConnection object were to create a new session and then disconnect with the release option, the session would remain connected. The next session to make a connection would be given the session that is already connected to the host.

 

The following example demonstrates the use of the release option in a disconnect.

 

 

There are a quite a few things different in the code above to what has already been done. The standard connection is made, but then a HostScreen object is retrieved using the getScreen method. The HostScreen object is used to interact with the screen, and in this case to send some keystrokes and an action key (the enter key) to the screen. This should put the session on a new screen, which means that when the session is released it will not be on the starting screen.

 

The second HostConnection object connects in the standard manner, but take note that it does NOT use the SessionKey. In fact, the SessionKey is no longer valid. Once connected, the HostConnection object checks to see if the session has already been connected. If not, then it runs the same login sequence that was performed for the first HostConnection object.

 

What is important to understand here is that if the connection and login has already been performed then it will not have to be done again. This gives a great performance increase as the host connection and signon sequence is processor intensive and time-consuming.