1

I'm trying to connect a client to server through python sockets. Clients connect successfully on my computer, but people on other networks cannot connect.

TimeoutError: [WinError 10060] on the client side after failing to connect. Here is the code for my python scripts.

Server.py

import socket
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = "0.0.0.0"
port = 8000
print (host)
print (port)
serversocket.bind((host, port))

Client.py

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = "##.###.###.###" # server's public ip.
port = 8001
s.connect((host,port))
print("Connected to server.")
s.send(("Client connected").encode())

The ports are different because I can't connect without the local and external ports being different on my router; local being 8000 and external being 8001. If the client is on my computer, the server reveals it's being connected to by the public ip, so it's passing through my router.

Doing nmap -p 8000 -sN -P0 192.168.0.# on my server computer, reveals the port is closed using http-alt. Doing it on my public ip reveals that it's open|filtered using vcom-tunnel, but it's open|filtered on almost every port.

What I have tried:

  • Port forwarding with local_port=8000 and remote_port=8001. External ip set to my public ip, and my local ip set to my computer ip; 192.168.0.#
  • Using DMZ Host (Exposed Host) on server-side router.
  • Enabling and disabling UPNP, WAN Blocking, Ipsec PassThrough & PPTP PassThrough separately on server-side router.
  • Allowing TCP port 8000, on local and remote through server-side firewall.
  • Allowing program through firewall on public & private networks on client and server.
  • Allowing TCP port 8001, on local and remote through client-side firewall.
  • Binding client ip with socket.bind((client_ip,port)) on client.py

It might be the port I'm using having to do with http-alt/vcom-tunnel, instead of one with upnp.

Dubstep
  • 137
  • 1
  • 10

1 Answers1

1

The problem was setting the external ip on my port forward to my public ip. What ip it was set to, it was only scanning for my ip, which let to only my computer being able to connect to it. I set the external ip to 0.0.0.0, making the port open to all ips.

Dubstep
  • 137
  • 1
  • 10