Zwischenstand Server- und Clientinitialisierung (Verbindung funktioniert noch nicht)
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import socket
|
||||
|
||||
myserver = socket.socket()
|
||||
hostname = myserver.gethostname()
|
||||
port = 12345
|
||||
myserver.bind((hostname, port))
|
||||
myserver.listen()
|
||||
|
||||
while True:
|
||||
(connection, addr) = myserver.accept()
|
||||
msg_from_client = myserver.recv(1024)
|
||||
in_capital_letters = msg_from_client.upper()
|
||||
connection.send(in_capital_letters.encode('utf-8'))
|
||||
connection.close()
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import socket
|
||||
|
||||
myclient = socket.socket()
|
||||
hostname = myserver.gethostname()
|
||||
port = 12345
|
||||
|
||||
myclient.connect((hostname, port))
|
||||
|
||||
Reference in New Issue
Block a user