Troy D
Troy D

Reputation: 2245

Java Detect Microsoft Remote Desktop Disconnection

I have a Java program running on a Windows remote server, which I monitor through Microsoft Remote Desktop. If the remote connection gets severed, I want the program to wait a period of time to see if the connection gets reestablished, and if not, to terminate the program in an orderly fashion. How can I set up the program to monitor and respond to the state of the remote connection?

Upvotes: 2

Views: 252

Answers (1)

Hazim
Hazim

Reputation: 381

The best approaches to solving this would be to monitor various system resources that a remote connection would make such as network activity, processes, etc. For example, figure out what port remote connections run on (I think it's 3389?) and actively monitor that port for connections/disconnections.

Check out pCap4J, a library that will help monitor network activity.

(ps: for what it's worth, a solution written in C or any other low level language would be a lot more productive)

Upvotes: 0

Related Questions