I have to apps that communicate using remoting. This works fine on a
single machine.
When I run the same on a terminal server I get an error when
registering a channel, when the second client starts the application.
Why do I get this error? How can I resolve this Issue
Tosch
> I have to apps that communicate using remoting. This works fine on a
> single machine.
[quoted text clipped - 3 lines]
>
> Tosch
The problem you have is due to the fact that you cannot open more than
1 port on the same computer.
I had the same situation lately. The solution I used is quite
simple. I get the session id from the terminal server and add it to
my port. That assure me I got a unique port for every session. To get
the remoting session id use the following method:
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
static extern bool ProcessIdToSessionId(uint dwProcessId, out
uint pSessionId);
public long GetRemotingPort()
{
uint sessionId = 0;
System.Diagnostics.Process currentProcess =
System.Diagnostics.Process.GetCurrentProcess();
bool result = ProcessIdToSessionId((uint)currentProcess.Id,
out sessionId);
return 65000 + sessionId;
}
In this example, I removed all error trapping validation. The base
port i was using is 65000 and if not on a terminal server, the
ProcessIdToSessionId returns 0.
Nicolas Bouchard
tosch - 21 Feb 2008 14:47 GMT
On 21 Feb., 15:05, Nicolas Bouchard <nicolas.bouch...@gmail.com>
wrote:
> > I have to apps that communicate using remoting. This works fine on a
> > single machine.
[quoted text clipped - 31 lines]
>
> Nicolas Bouchard
Nicolas,
thanks for your good solution. Can the port number ever be to big?
What's the max for the session id?
Thomas
Nicolas Bouchard - 21 Feb 2008 15:12 GMT
> Nicolas,
> thanks for your good solution. Can the port number ever be to big?
[quoted text clipped - 3 lines]
>
> - Show quoted text -
The number maximum of session on terminal server depends on the
licensing used. The minimum is 5 licenses. The highest TCP port
available is 65535.