Search code examples
pythonsocketsconnection

Problems with connecting to my python chat-app server


I am new to python socket programming and was following a tutorial building a chat-app, using kivy and sockets. I am running my server on my main PC and I was trying to connect from my laptop to this Server, but it doesn't work (Both my PC and laptop are connected via Ethernet cable). When I run the client.py on the PC that I host my Server on, everything works fine.

I tried running the Server on my 0.0.0.0 address and then connecting from my laptop to the IP address that appears on my Server PC if I type in "ipconfig" (192.168.2.x) but it didn't work. I also tried running the server just on the Ethernet-Adapter IP that appears when I type in "ipconfig" (so 192.168.2.x) but this doesn't work neither.

Lastly I have tried defining my Server IP by using the built in socket function: socket.gethostbyname(socket.gethostname()) (weirdly when I run this, my Server runs on my VMware Network Adapter (192.168.66.x) instead of my Ethernet-Adapter). But this too didn't work :(

The client.py code on my laptop always returns this error:

connection error: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Would appreciate any help :)

edit: Could this have something to do with the firewall on my PC blocking connections or something?


Solution

  • Found the Problem! Today it actually worked by disabling my host PCs Windows Defender internal Firewall and the running the Server on 0.0.0.0, which is very weird because yesterday it didn't work...