Solved

Windows application responding to wrong user account through socket

Posted on 2014-03-26
5
245 Views
Last Modified: 2014-04-15
Hi Experts,

I have an issue where I have a simple application that exposes a web server for inter-process communication.  This application is meant for a single user to make requests to it.  It is not a windows service.

If someone logs out, no problem.  The application is shut down and so the web server goes away.  But if someone uses the user switching functionality - the application remains and will respond to requests that come in on that port from a separate user account.

How can I fix this?

Thanks for any ideas!
Mike
0
Comment
Question by:thready
  • 3
  • 2
5 Comments
 
LVL 33

Expert Comment

by:sarabande
ID: 39956504
your webserver could register to receive a WM_WTSSESSION_CHANGE message.

see
http://msdn.microsoft.com/en-us/library/windows/desktop/bb776893(v=vs.85).aspx

then it could end or deny requests until the user was switched back.

Sara
0
 
LVL 1

Author Comment

by:thready
ID: 39956513
Thanks Sara, you're brilliant as usual.  But I forgot to mention another thing.  It's also possible to have terminals connected where 2 users are actively using the machine.  What about that scenario?
0
 
LVL 33

Accepted Solution

by:
sarabande earned 500 total points
ID: 39956819
you probably need to establish two webservers one for each account. the webservers then would need an own port to listen for each account. you may define a user environment variable for the port and pass it to web server at creation time.

Sara
0
 
LVL 1

Author Closing Comment

by:thready
ID: 39958771
Thanks
0
 
LVL 1

Author Comment

by:thready
ID: 40002385
Hi again Sara,

I'm looking again at your first comment - do you know if the session state change event for WM_WTSSESSION_CHANGE is always WTS_CONSOLE_DISCONNECT and WTS_CONSOLE_CONNECT for when the user switches?
0

Featured Post

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question