s = socket.socket() | s = socket.socket() | ||||
host = socket.gethostname() | |||||
host = socket.gethostbyname('localhost') | |||||
port = 22225 | port = 22225 | ||||
s.connect((host, port)) | s.connect((host, port)) | ||||
bytes = s.recv(4096) | bytes = s.recv(4096) | ||||
print(bytes.decode('utf-8')) | print(bytes.decode('utf-8')) | ||||
else: | else: | ||||
print(message) | |||||
s.close() | s.close() |
import socket | import socket | ||||
s = socket.socket() | s = socket.socket() | ||||
host = socket.gethostname() | |||||
host = socket.gethostbyname('localhost') | |||||
port = 22225 | port = 22225 | ||||
s.bind((host, port)) | s.bind((host, port)) | ||||
s.listen() | s.listen() |