Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Windows application responding to wrong user account through socket

Posted on 2014-03-26
5
Medium Priority
?
254 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 35

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 35

Accepted Solution

by:
sarabande earned 2000 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

Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

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…
What You Need to Know when Searching for a Webhost Provider
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

721 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