An application I use downloads data from a specific server, and I need it to sleep after the download has finished and the socket is closed.
However downloads take place at random days, the app that downloads checks for updates and only downloads if there is one
Proto Recv-Q Send-Q Local Address Foreign Address (state) tcp4 0 0 192.168.1.29.51005 126.96.36.199.80 ESTABLISHED
Pretend 188.8.131.52 is server where data is downloaded from.
Is there a way to prevent the computer sleeping while there is HTTP session to a specific server in progress?
Now please excuse my pseduo script, but it's the best way I could try
netstat -anp tcp IF Foreign Address = 184.108.40.206 & state = ESTABLISHED then WAIT AND CHECK IN 10 MINUTES else pmset sleepnow fi