Browse Source

Gesteuerter Verbindungsabbau (hostname geändert)

master
Nadege 5 years ago
parent
commit
89d83fe213
2 changed files with 2 additions and 3 deletions
  1. 1
    2
      client.py
  2. 1
    1
      server.py

+ 1
- 2
client.py View File





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()

+ 1
- 1
server.py View File

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()

Loading…
Cancel
Save