You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
331 B
14 lines
331 B
11 months ago
|
import socket
|
||
|
|
||
|
HOST = '127.0.0.1'
|
||
|
PORT = 2000
|
||
|
|
||
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||
|
try:
|
||
|
s.connect((HOST, PORT))
|
||
|
print('Conectado con éxito')
|
||
|
except socket.error as exc:
|
||
|
print ("Excepción de socket: %s" % exc)
|
||
|
finally:
|
||
|
#cerramos la conexión, aunque el servidor ya la habrá cerrado
|
||
|
s.close()
|