1.termin
This commit is contained in:
parent
058fd275e4
commit
faa0fa5553
19
Prakt1_Socket.py
Normal file
19
Prakt1_Socket.py
Normal file
@ -0,0 +1,19 @@
|
||||
import socket
|
||||
|
||||
s = socket.socket()
|
||||
host = socket.gethostname()
|
||||
port = 21345
|
||||
s.bind((host, port))
|
||||
s.listen()
|
||||
|
||||
while True:
|
||||
(connection, addr) = s.accept()
|
||||
print('Verbindung von ', addr)
|
||||
msg = 'Server sagt Hallo'
|
||||
connection.send(msg.encode('utf-8'))
|
||||
msg = connection.recv(1024)
|
||||
|
||||
#connection.send(msg)
|
||||
msg = msg.decode('utf-8')
|
||||
print(msg)
|
||||
connection.close()
|
Loading…
x
Reference in New Issue
Block a user