If I exit my application normally, aboutToQuit is called and I can do some cleanup, however, if the user logs off of windows, my application closes immediately and aboutToQuit is never called.
The program functions as an application launcher that logs to a server. Each time an application launches, it sends a message to a server with the name (you launch the application from within my app).
Normally, a user shuts down the application when they are done and I log the event. If they shutdown the computer though, I want to send a application's shutdown log event in aboutToQuit, but that function is never called.
I've searched for options and short of making my application into a Windows service (haven't tried this yet), nothing is working.
Any ideas?
This appears to be fixed in Qt5.2.0 as I now receive a QApplication::commitDataRequest() signal at windows logoff.
Related
My college requires students to periodically authenticate for using WiFi and LAN. I am writing a Python script that will automatically do that so that I don't have to manually enter my credentials. The authentication is also separate for WiFi and LAN, and that makes me enter my credentials when I switch between them. So, for the python script, I want to detect when my authentication has expired and my connection is disconnected.
I also don't want the python script to be running constantly in the background and pinging a website as that really isn't optimal and I'll have to run the script every time my PC restarts. I was thinking of using the Windows Task Scheduler to fire the script when it detects that my connection is lost. The trigger event cannot be fixed intervals as the connection can be lost in between the intervals and also when switching between LAN and WiFi.
So, is there any network event that will capture the functionality I want? As Windows gives a notification of "opening the browser to connect" I feel there has to be a background event running.
I tried the NetworkProfile/Operational Event in the Task Scheduler with event id 10001 and 8003. But that just fires when I switch off the WiFi of my PC.
Thank you
Got it!
NetworkProfile/Operational Event with ID 4002 waits for network authentication.
In order to hoop the stdout of a console application, my process manager start the console application using CreateProcess with bInheritHandles to be true, everything works except that when my process manager was closed but the console application was still alive, if try to restart my process manager, Windows will report error that the port was in used (my process manager open a port to play the service role), and if i use TCPView to check the port status, i found my process manager seems to be still “alive”, the PID was still there but it could not be found in Task Manager, the port was listed in the TCPView but could not be found via NETSTAT command — Windows failed to terminate my process manager due to the inherited handles of the console application, if i need to restart my process manager, i have to kill the console application first.
Is there any way to terminate my process manager gracefully even when the inherited console application still alive?
I am trying to see if there is a way to set up an automatic job that runs whenever there is a certain error within the server occurs. So for an example, whenever an event ID 7001 occurs, a notification email should be sent out and the server should be restarted. I was able to set up a task job so that a notification email would be sent out, but how do I set up a job to restart the server, right after the notification is sent out?
If you are talking about a physical server then you can call a simple script restarting your server from the code that you used for sending email (I suppose it was also a script or some kind of program you wrote).
E.g. if you have a Windows server, than you could simply call a Batch 'script':
shutdown -r
Or if you use a Linux/Unix server, then you could call a Bash 'script' command:
reboot
You can call it right after the code sending the email.
I have a test driver program that launches a separate test server process. The test server process listens on a local port, and after it's ready, the test driver runs a test that accesses the test server.
Currently the test driver repeatedly tries to connect to the local port (loop some, sleep some, try again). It's not an optimal solution, and is clearly unreliable.
Is it possible to wait for some event that says "somebody listens on a local port"? Trying to connect to early results in a "port closed" error.
I'd like to implement the solution on Windows, Linux, and Mac OS X. If you have some tips for any of these systems, it's welcome (it's probably going to be system-specific in each case).
On Windows I use a named event for this kind of thing.
The test harness can create the event and communicate the name of the event to the server that it launches; it then waits on the event to be signalled before continuing the test. The server then connects to the event, initialises itself and once it's ready to accept connections it signals the event.
Well, if you launch the server process, you can intercept the stdout of the server right?
So have the server output "server started" when the socket ready. The driver should wait until the server sends this string to stdout, then try to connect to the server port.
I am running Vista Ultimate x64 on my system. I have an application that works fine on a remote server to send messages to the MSMQ instance running on it. When I bring the application to my local system and attempt to send a message it doesn't send, but doesn't error out either. I even tried setting up a local MSMQ instance and the same happens with that one - no errors, but no messages either. The queues are transactional and the code itself is transaction-based.
Any suggestions? I tried implementing the journal option (assuming this is like logging) and it doesn't record anything.
I dug through event viewer and the only error I am seeing (actually it's a warning) is:
MSDTC encountered an error (HR=0x80000171) while attempting to establish a secure connection with system [ComputerName]
All the standard stuff has been checked like firewalls, is MSMQ running, etc and when I put the app, unaltered, on the remote server it works 100% of the time.
The problem is not with MSMQ directly. You are using transactioning queuing which requires MSDTC to be setup and configured correctly.