Re: WTSOpenServer() - WtsAPI32
From: Michael C (michaelco_at_optonline.net)
Date: 06/01/04
- Next message: S Vijay [MSFT]: "RE: Cannot Save file to desktop !!"
- Previous message: Greg Lirette [MSFT]: "Re: WTSOpenServer() - WtsAPI32"
- In reply to: Greg Lirette [MSFT]: "Re: WTSOpenServer() - WtsAPI32"
- Next in thread: Michael C: "Re: WTSOpenServer() - WtsAPI32"
- Reply: Michael C: "Re: WTSOpenServer() - WtsAPI32"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 01 Jun 2004 06:07:01 GMT
No, no delay locally. I'm running a Win XP Pro workstation, and my WTS
machines on the network are all Win2K, Win2003 and XP. I think I've finally
figured out how to multithread the WTSOpenServer() calls so that it now
gathers all the handles in about 10-15 seconds total (for 70 machines)
regardless of my Query Information permissions. I think the delay is due to
the security set-up for WTS. I think I read that it tries to log you on
several different ways (local, domain, etc.), one at a time. Of course if I
ultimately don't have the permissions then it just wasted a whole bunch of
time beating it's head against the wall (along with me).
Now I just need to figure out how to associate the server name (which I have
in an ArrayList) with the WTS server handle that the WTSOpenServer()
function returns (it gets dis-associated by the asynchronous BeginInvoke),
and update my listbox control on the form without breaking the golden rule
(don't update the UI from a worker thread). I tried the .AsyncState
property for recalling my server name (you pass the server name to
WTSOpenServer()) but it just doesn't seem to cut it. Any ideas on that one?
Thanks,
Michael C
"Greg Lirette [MSFT]" <gregoryl@online.microsoft.com> wrote in message
news:%23izUa%234REHA.3140@tk2msftngp13.phx.gbl...
> What OS are you on and what is the target OS? If you run the API locally
> with NULL as the parameter is there still the delay? It would be
> interesting to see the call stack during the delay.
>
>
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Michael C" <michaelco@optonline.net> wrote in message
> news:UNSuc.1843$eU6.732078@news4.srv.hcvlny.cv.net...
> > That's an interesting thought, so I checked it out. It doesn't fail as
> long
> > as it can find the Windows Term Server you specified on the network. It
> > returns a handle to the server specified, even after the delay. I then
> run
> > the WTSEnumerateSessions() API function against the server handle
> returned.
> >
> > If I have no access to Query Information on the server,
> > WTSEnumerateSessions() returns a record count of 0. I've nailed down the
> > delay to the WTSOpenServer() function though, and only in cases where
> > WTSEnumerateSessions() subsequently returns a record count of 0 (i.e., I
> > have no Query Information access). For servers that I have Query
> > Information access to, it consistently returns at least one session (the
> > Console session) very quickly. Usually it returns 3 or more sessions to
> > include a listening session and recently disconnected sessions.
> >
> > I've eliminated a lot of the delay by adding a server exclusion text
file
> > that lets me specify which servers to ignore, but I think that's only
half
> > the solution. There has got to be a better (i.e. faster) way to get a
> > server handle to a WTS server, or at least to call WTSOpenServer()
> multiple
> > times asynchronously to make the program more responsive and efficient.
> >
> > Thanks,
> > Michael C.
> >
> > "Greg Lirette [MSFT]" <gregoryl@online.microsoft.com> wrote in message
> > news:eI1sBO4REHA.620@TK2MSFTNGP10.phx.gbl...
> > > Curious does the API fail or work after the delay and if it fails what
> is
> > > the error?
> > >
> > >
> > > --
> > > This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> > > "Michael C" <michaelco@optonline.net> wrote in message
> > > news:aiQuc.610$eU6.206643@news4.srv.hcvlny.cv.net...
> > > > I'm writing an app that uses the Windows Term Svcs API (in C#).
> > > Everything
> > > > works fine when running it against servers that I have "Query
> > Information"
> > > > access to; but for servers that I don't have "Query Information"
> access
> > > to,
> > > > the WTSOpenServer() function seems to take up to 10 seconds to
> respond.
> > > I'm
> > > > querying over 70 servers and a 700 second delay is unacceptable.
Does
> > > > anyone know how to speed up WTSOpenServer() or get around this
delay?
> > > >
> > > > Thanks,
> > > > Michael C.
> > > >
> > > >
> > >
> > >
> >
> >
>
>
- Next message: S Vijay [MSFT]: "RE: Cannot Save file to desktop !!"
- Previous message: Greg Lirette [MSFT]: "Re: WTSOpenServer() - WtsAPI32"
- In reply to: Greg Lirette [MSFT]: "Re: WTSOpenServer() - WtsAPI32"
- Next in thread: Michael C: "Re: WTSOpenServer() - WtsAPI32"
- Reply: Michael C: "Re: WTSOpenServer() - WtsAPI32"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|