VS needs to check the network module and right-click the VS project. Select Qt Project Settings. Switch to the Qt Modules page and check NetWork
The QString hostNme = QHostInfo::localHostName(); hostName variable in the above code is the computer name. And when the computer name is Chinese , the IP address cannot be resolved.