Hello,
I've a **Debian vps** and I'm trying to make a **chat program**. I've the following code running on the server (vps):
import socket
host, port = "51.77.66.55",9999
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((host, port))
s.listen(5)
client,addr = s.accept()
print("Connection received from :",addr)
while True:
msg = client.recv(1024)
print(str(msg,"utf-8"))
and the following running on my machine:
import socket
host, port = "51.77.66.55",9999
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
while True:
msg = input("--> ")
s.send(bytes(msg,"utf-8"))
This code is just a simple test but I can't seem to make it work.
I get the error : **ConnectionRefusedError: [Errno 111] Connection refused**
I'm quite certain this is not a problem with my code because it works fine with 127.0.0.1 on my machine.
The **iptables** of my vps is **open for all the ports**.
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
**What am I missing here ??**
**Is there another kind of firewall I'm not aware of? Is OVH blocking certain ports?**
thanks a lot
ps : 51.77.66.55 is not the actual ip of my vps but I checked, it not an ip problem either. I also tried with other ports like 80 and got the same results.
Problems connecting to python Socket on a vps (for a chat program)
Related questions
- Installing Operating System from custom image on OVH VPS ( CentOS 8 Tutorial)
59026
11.01.2020 21:11
- SMTP server on VPS and port 25 opening
50073
10.12.2025 13:59
- Mumbai VPS data-center availability
47048
23.12.2025 04:48
- Nameserver for my vps
46669
07.08.2018 11:35
- Remote access to MySQL database
45718
16.01.2018 15:29
- VPS stuck in “Saving…” for over 24 hours – No SSH, No KVM, No Rescue
45563
10.01.2026 22:36
- Advice on products to run a simple website + CMS.
41854
07.01.2026 14:58
- VPS login and password not accepted. Reboot in Rescue Mode results in root and temp password not being accepted
40782
15.01.2026 20:04
- Change server location
38191
06.11.2020 10:16
- Redirect domain to vps
37699
03.01.2018 22:32