Jump to content
Welcome to our new Citrix community!
  • 0

Prevent ICA Client timeout during inactivity


Administrator

Question

I am attempting to use VS .NET(either J# or VB) to write a client executable which will prevent my web ICA client from timing out with the server when I leave my desk for an extended period of time. I am accessing the process(Outlook specifically) via main window title, but when I generate programmatic mouse/icon movement or sendKeys() to the process, the client still disconnects after the citrix server specified 15 minutes of no activity.

What specific events on the client side does the ICA client observe to determine that the connection is active? What programmatic events can I generate to prevent my client from disconnecting with the Citrix Server?

Here is the VB.net code thus far:

Option Explicit On

Imports System.Threading

Module Module1

Private procName As String = "\\Remote, 128-bit SSL/TLS."
Private fullscreenProcName As String = "Citrix ICA Client"
Private processes() As Process
Private proc As Process

Sub keepAlive()
Dim currentPosition As Point
Dim theCursor As Cursor

theCursor = Cursor.Current
currentPosition = theCursor.Position
Dim newPosition As Point
newPosition.X = 300
newPosition.Y = 300
theCursor.Position = newPosition
'Console.WriteLine("Mouse moved")
'MsgBox("Mouse is moved")
theCursor.Position = currentPosition
theCursor.Show()

End Sub

Sub PreventTimeout()


processes = Process.GetProcesses
For Each proc In processes

If InStr(proc.MainWindowTitle, procName) <> 0 Then
keepAlive()
'Microsoft.VisualBasic.AppActivate(proc.MainWindowTitle)
'Send the <Enter> Key to the app
'System.Windows.Forms.SendKeys.SendWait(Keys.Enter)
'MsgBox("App kept alive.")

ElseIf InStr(proc.MainWindowTitle, fullscreenProcName) <> 0 Then
keepAlive()
'Microsoft.VisualBasic.AppActivate(proc.MainWindowTitle)
'Send the <Enter> Key to the app
'System.Windows.Forms.SendKeys.SendWait(Keys.Enter)
'MsgBox("App kept alive.")
End If

proc = Nothing

Next

processes = Nothing

End Sub

Sub Main()
While (1)
PreventTimeout()
'Prevent timeout every 9 minutes
Thread.CurrentThread.Sleep(540000)
End While
End Sub

End Module

Link to comment

16 answers to this question

Recommended Posts

  • 0

Ica keepalive can be set from the serverside, without intervention from the clientside:

TCP Keepalive: (can also be set on clientside, and also boosts client-server traffic on the NIC)

[KEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"KeepAliveTime"=dword:0000ea60
"KeepAliveInterval"=dword:000003e8

ICA Keepalive:

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Citrix]
"IcaEnableKeepAlive"=dword:00000001
"IcaKeepAliveInterval"=dword:0000003c

Optimised setting for wan environments to minimise latency:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"TcpMaxDataRetransmissions"="10"

Also check all hardware like routers, firewalls and managed switches
for idle settings, and make sure they are not active.

MTU:

HKLM\system\currentcontrolset\services\tcpip\parameters\interfaces\"ID for Adapter"

Add a dword value MTU with a value of 1492 decimal

(Default MTU for ethernet = 1500, for DSL = 1492, for ISDN = 576 )

Link to comment
  • 0

> So TCP Keep Alive did not work. Can I
> accomplish what I am trying to do programmatically?

Setting ICA keepalive on the citrix server, is generally accepted by the Citrix administrators community, and has even been built in as a feature in FR3.
Is there any chance that you can pusuade the administrator of the server, to activate this setting?

Link to comment
  • 0

> There is no way I can convince the Administrator.
> Can I set ICA Keep Alive on the client?

Not that i know of, sorry.

> Is the client trying to detect my mouse moving? A
> keypress? When I have the ICA Web client Outlook
> open, and I am working on other development, it does
> not close.

Could be, that the session is somehow picking up clipboard actions, or stuff like this, but i'm not sure.

Inactivity idle settings are also something an administrator can have set. (if idle for 30 minutes; break connection.)

I really think you're administrator should be much more helpfull to you. I he keeps refusing, ill show you a few way's to hack the server, and do it yourself.
This kind of administrators are besides strongheaded, also not very good at their job, making them an easy target. :-)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...