You need to check the connection and the code. Firstly, revise the code to see if it's properly used then access the program's settings and go to the network section. Configure the connection and test the connection to the machine. Alternatively, go to Device Manager and check all the network devices.
After this procedure, go to Start > Control Panel > System and Security > Windows Firewall. Make sure software is allowed to communicate internally and externally. This should fix it.