Re: Remoting on Terminal Server

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



On 21 Feb., 15:05, Nicolas Bouchard <nicolas.bouch...@xxxxxxxxx>
wrote:
On Feb 21, 7:31 am, tosch <to...@xxxxxxxxxxxxx> wrote:

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

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

Nicolas,
thanks for your good solution. Can the port number ever be to big?
What's the max for the session id?

Thomas
.



Relevant Pages

  • Help: FTP over SSH to Windows FTP server behind Linux gateway/firewall
    ... How do I encrypt a regular ftp session over SSH with the following ... rp: = remote port: ...
    (comp.security.ssh)
  • Re: Remoting on Terminal Server
    ... port on the same computer. ... I get the session id from the terminal server and add it to ... That assure me I got a unique port for every session. ...
    (microsoft.public.dotnet.framework.remoting)
  • Printer Mapping - HELP!!!
    ... I reboot the Terminal Server to insure there are no ... I log on to the terminal server. ... The other oddity is that one port seems to be from a brand ... new session, ...
    (microsoft.public.win2000.termserv.clients)
  • RE: Printer Mapping - HELP!!!
    ... Microsoft MVP - Terminal Server ... LPT1 and PRN0. ... The other oddity is that one port seems to be from a brand ... new session, ...
    (microsoft.public.win2000.termserv.clients)
  • RE: iptables - port redirection - VNC
    ... virtual X sessions, and they normally start with session 1 since session 0 ... the port you need exposed in the router pinhole, ... iptables - port redirection - VNC ...
    (RedHat)