0

I made a simple program that when i click on a button it would connect to my python server.

MainActivity.java

Socket socket = new Socket("172.18.144.1", 8000);

server.py

import socket


s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
port = 8000
IP = "172.18.144.1"
s.bind((IP, port))
print(f"[...] Searching for incoming connections on port {port} as {IP}")
s.listen(5)
 
while True:
    clt,adr=s.accept()
    print(f"Connected to {addr}")  
    clt.send("Socket Programming in Python".encode())

But i get this error: java.net.ConnectException: failed to connect to / 172.18.144.1 (port 8000) from /:: (port 45190): connect failed: ECONNREFUSED (Connection refused) I have checked the firewall, its turned off, the server is on, and they are on the same network. What can i do?

GamrJake
  • 21
  • 1
  • 6

0 Answers0