how to check computer's state using Qt?

前端 未结 3 1014
情歌与酒
情歌与酒 2020-12-12 00:30

i\'m trying to get computer\'s state in my LAN... thought about using QTcpSocket but it\'s not realy effective since port also should be inserted as:

socket-         


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-12 01:13

    Are you trying to check if your local machine is on the network or if a target machine is ?

    There isn't a good cross platform way of doing this. The nearest on qt is QNetworkInterface, and check attribute "ISup" - it's not perfect, it may be active if you have a network cable connected but just to a router, and inactive if you have a 3G modem but aren't on a call.

    On Windows check InternetGetConnectedState()

提交回复
热议问题