C# data to Java -


I want to know whether a Windows workstation is logged on or off in C # A solution has been found:

  Public class CheckForWorkstationLocking: IDisposable {Private session SewitchEventHandler sseh; Zero SysEventsCheck (Object Sender, SessionSwitchEventArgs E) {switch (e.Reson) {session session switch. Session Lock: Console. WrightLine ("Lock Exports"); break; Case session switch Unlock session: console.print line ("unlock combat"); break; }} Public runs zero () {sseh = new session in particular SysEventsCheck; SystemEvents.SessionSwitch + = sseh; } #region IDisposable members dispose of public zeros () {SystemEvents.SessionSwitch - = sseh; } #endregion}  

But at the end I'll need Boolean in the java program .

I already tried the following:
I started both programs and write in C # in a file from where the data has changed or not Java (No need to say that this solution is slow and inadequate)

Another solution would be:
Java C # .exe that waits until Java connects it through sockets and they share data over open connections .

Is there a better way to resolve this? Less effort from the Socket interface solution?

You do not have this to go to any complex length, it can be quite simple is.

Save boolean to a file in C #, then a file is viewing the directory in Java. If there is a change then he can read the file in Java and get the value of the boolean. Such a solution will not be expensive and will eat a lot of CPU chunks, like a solution where you have a loop that used to check the file.

Java code may be as simple as

  import static java.nio.file.StandardWatchEventKinds. *; Path Dire = ...; Try {Watch Key = Diaper. Registry (Viewer, ENTRART, ENTIDIEETE, ENTIMIDEFE); } Hold (IOException x) {System.err.println (x); }  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -