0

I wrote a small application that is mostly listening to a message feed on a TCP connection. This application suffers from a connection drop (and so missing important messages) whenever the PC goes into energy saving mode - not sure what level, but the somewhere between screen turn off and before standby. Anyway, my question is, how would I programmatically prevent a windows host from entering a lower level while the application runs - or how can I protect the TCP connection from being dropped?

Kai
  • 2,145
  • 1
  • 20
  • 35
  • Firstly I would suspect something other than power saving could be the cause of the dropped connection. But if you're right, then there's nothing practicable you can do about it – g00se Sep 22 '22 at 22:48
  • It is the only pattern. It is also verified with Wireshark, that at the time when the computer goes into a lower state the whole communication drops. I kept my computer running during a work day and there was no hiccup for half a day. I have a break at dinner time and come back later, enter my password and its gone. – Kai Sep 24 '22 at 06:16
  • Some NIC drivers *do* have a power-saving mode. But my point remains that you can't affect that with Java. Could be doable with settings if you're lucky. – g00se Sep 24 '22 at 08:04
  • But it can be done. Apps like VLC, Chrome can stop screensaver, power state drop when videos are running. If they can do it, there must be a system call that we could do using JNI. – Kai Sep 25 '22 at 23:49
  • Yes if you resort to native code it could be possible – g00se Sep 26 '22 at 03:42

0 Answers0