I tried to make a socket in Python 3.5.1, but when I went to test it, it only connects with me. I tried connecting to another computer (from my friend), but it does not connect. Does anyone know how to make a socket that actually connects?
If anyone wants to see, here is my problematic socket: link
#Cliente
import socket
HOST = 'Aqui eu coloco o ip'
PORT = 5000
tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
dest = (HOST, PORT)
tcp.connect(dest)
print('Para sair use CTRL+X\n')
msg = input()
while msg != '\x18':
tcp.send(msg)
msg = input()
tcp.close()
#Servidor
import socket
HOST = ''
PORT = 5000
tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
orig = (HOST, PORT)
tcp.bind(orig)
tcp.listen(1)
while True:
con, cliente = tcp.accept()
print('Concetado por', cliente)
while True:
msg = con.recv(1024)
if not(msg): break
print(cliente, msg)
print('Finalizando conexao do cliente', cliente)
con.close()