logo

The ConnectWise Control forum has moved to ConnectWise University! This forum has been locked and is in read-only mode. Click here for instructions on how to access the new forum.

Welcome Guest! You can not login or register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Guest  
#1 Posted : Thursday, October 28, 2010 3:36:15 PM(UTC)
Guest


Rank: Advanced Member

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 4/9/2010(UTC)
Posts: 331

Was thanked: 2 time(s) in 2 post(s)
One problem I encountered while using Screen Connect is sometimes the security settings of the browser was set to high and thus preventing downloading the GuestClient.exe file. This prevents customers from joining the existing Screen Connect session. Our application is written in Java, so the solution I am looking for is to perhaps package the ScreenConnect jar files together with our applications and join the session from within our application. If you can provide some sample codes of how to join an existing session given the Invitation Code as input, that would help solve a lot of issues to help support customers.

Thanks,
Andy

Jake  
#2 Posted : Thursday, October 28, 2010 4:34:43 PM(UTC)
Jake


Rank: Administration

Medals: Level 4: Wise Old Owl! Received 100 Thanks!

Joined: 4/9/2010(UTC)
Posts: 2,061

Thanks: 1 times
Was thanked: 393 time(s) in 188 post(s)
You'll need a bit more than the invitation code to startup the client directly, but maybe I can cover that in another topic. The following assumes you have a bit more information to start the session.

Here is the contents of com.elsitech.screenconnect.client.Program class:

Code:
package com.elsitech.screenconnect.client;

import java.awt.Toolkit;
import java.net.InetSocketAddress;
import java.util.UUID;

import com.elsitech.screenconnect.Base64;
import com.elsitech.screenconnect.ProcessType;

public class Program {
	public static void main(String[] args) throws Exception {
		String applicationTitle = args[0];
		InetSocketAddress endPoint = new InetSocketAddress(args[1], Integer.parseInt(args[2]));
		UUID sessionID = UUID.fromString(args[3]);
		byte[] encryptionKey = Base64.decode(args[4]);
		ProcessType processType = ProcessType.valueOf(args[5]);
		String sessionTitle = args[6];

		Toolkit.getDefaultToolkit().setDynamicLayout(true);

		Client client = Client.create(processType);
		client.initialize(applicationTitle, endPoint, encryptionKey, sessionID, sessionTitle);
		client.start();
	}
}


Just for reference, when I debug I have the following set as my command line arguments:

Code:
ScreenConnect localhost 8041 2b6e7af1-dad7-452e-a234-c7e584d38fcf ISWOldXwlKfvFUHXmJd4jw== Guest test


In eclipse I'll just replace the 4th and 5th arguments with my sessionID and encryptionKey.

The applicationTitle can be anything you want, it will appear in various places as the title of the application.

The endPoint is the end point of our relay server. You should put this in the configuration of your application.

The sessionID you can get from our Session Manager service. I assume you are doing a CreateSession yourself?

The encryptionKey you can also get from our Session Manager service.

The processType will always be ProcessType.Guest in your case.

The sessionTitle can be anything you want really, similar to the applicationTitle. We use the name of the Host I think.

So once you have these you can instantiate the Client object with the create(processType) method, then initialize it, then start it, all from within your Java app.

The call Toolkit.getDefaultToolkit().setDynamicLayout(true); ... I hope won't mess with your other application. I think it's necessary for us to get events on window resizes.
ScreenConnect Team
Jake  
#3 Posted : Tuesday, November 23, 2010 5:11:00 PM(UTC)
Jake


Rank: Administration

Medals: Level 4: Wise Old Owl! Received 100 Thanks!

Joined: 4/9/2010(UTC)
Posts: 2,061

Thanks: 1 times
Was thanked: 393 time(s) in 188 post(s)
BTW, this has changed a bit. Here is the new code:

Code:
package com.elsitech.screenconnect.client;

import java.awt.Toolkit;
import java.net.InetSocketAddress;
import java.util.UUID;

import com.elsitech.screenconnect.Base64;
import com.elsitech.screenconnect.ProcessType;

public class Program {
	public static void main(String[] args) throws Exception {
		String applicationTitle = args[0];
		InetSocketAddress endPoint = new InetSocketAddress(args[1], Integer.parseInt(args[2]));
		UUID sessionID = UUID.fromString(args[3]);
		byte[] encryptionKey = Base64.decode(args[4]);
		ProcessType processType = ProcessType.valueOf(args[5]);
		String sessionTitle = args[6];

		Toolkit.getDefaultToolkit().setDynamicLayout(true);

		Client client = Client.create(processType, applicationTitle, endPoint, encryptionKey, sessionID, sessionTitle);
		client.start(new Runnable() {
			public void run() {
				System.exit(0);
			}
		});
	}
}


Mainly we now don't automatically System.exit when we close. We allow you to specify a callback (Runnable) that gets called when our stuff closes down. Because of WebStart, we must do a System.exit, but implementations can probably just do nothing. We had a few customers where our app stopping would close down their parent app because of the System.exit (oops).
ScreenConnect Team
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.