Solved

Windows application responding to wrong user account through socket

Posted on 2014-03-26
5
251 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 34

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 34

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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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.

617 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