If you're getting Error 31 when trying to connect to other networks, it's likely because your computer's firewall is blocking the connection. To fix this, you'll need to open the Windows Firewall and add an exception for the program or port that you're trying to connect to.
To do this, open the Control Panel and go to System and Security > Windows Firewall. Click on the Allow an app or feature through Windows Firewall option in the left sidebar.
On the next screen, click the Change settings button. This will bring up a list of all the programs that are currently allowed or blocked by your firewall. Find the program or port that you're trying to connect to and make sure it's set to Allow.
If it's not listed, you can click the Add another app button and browse for it on your computer. Once you've added the exception, try connecting again and see if Error 31 has been fixed.