Subject: Avoiding X2GO Servers all using the same SSH_PORT - what conflicts when try to connect to different servers from one windows terminal (multiple sessions of x2go client)

From: Robert Nowotny <[email-masked]>
Date: Mon, 17 Aug 2015 15:53:21 +0200

Package: x2goagent
Version: 3.5.0.32

As discussed with IONIC, there is a problem when You try to connect to 
different servers from Windows at the same time, using multiple 
instances of x2go client.
The reason is, that the x2go servers are all using the same SSH_Port. 
That should not be a problem from my point of view, so that behaviour 
should be further investigated.

The problem was reported already a very long time ago, but still exists 
: https://www.mail-archive.com/[email-masked]/msg00547.html

In the meantime, here a small patch for x2gostartagent script:
That patch uses a different SSH_PORT for each Server, therefore try to 
avoid conflicts.

There are two methods implemented :

method one, suitable for Class "C" Networks, with no possible conflicts. 
The SSH Port is dependent on the last octet of the servers host adress.
method two, with randomized ports, what may lead to conflicts from case 
to case, but can handle networks were servers might have the same last 
octet of the host adress.

However, that patch enables to have multiple instances of x2goclients 
running on one windows machine, against different hosts.

please find attached the IRC conversation log with Ionic, as well as the 
patched script for x2gostartagent

I hove it can be committed, I am getting tired to patch my hosts on 
every x2go server update ;-)

yours sincerely

Robert Nowotny
Rotek GmbH