vanessa
This commit is contained in:
parent
03bc287bd3
commit
63f79d426c
25
client.py
25
client.py
@ -1,12 +1,23 @@
|
||||
import socket
|
||||
|
||||
s = socket.socket()
|
||||
host = socket.gethostname()
|
||||
port = 2345
|
||||
host = socket.gethostbyname('localhost')
|
||||
port = 64432
|
||||
|
||||
|
||||
s.connect((host,port))
|
||||
msg = input(' ')
|
||||
byte = s.send(msg.encode('utf-8'))
|
||||
recievemsg = s.recv(1024)
|
||||
print(recievemsg.decode('utf-8'))
|
||||
s.close()
|
||||
|
||||
#msg = input(' ')
|
||||
#byte = s.send(msg.encode('utf-8'))
|
||||
#recievemsg = s.recv(1024)
|
||||
#print(recievemsg.decode('utf-8'))
|
||||
#s.close()
|
||||
|
||||
message = 'hi'
|
||||
while message != 'STOP':
|
||||
message = input('eingabe: ')
|
||||
s.send(message.encode('utf-8'))
|
||||
bytes = s.recv(4096)
|
||||
print(bytes.decode('utf-8'))
|
||||
else:
|
||||
s.close()
|
23
server.py
23
server.py
@ -1,19 +1,20 @@
|
||||
import socket
|
||||
|
||||
s = socket.socket ()
|
||||
host = socket.gethostname()
|
||||
port = 2345
|
||||
host = socket.gethostbyname('localhost')
|
||||
port = 64432
|
||||
s.bind((host,port))
|
||||
s.listen()
|
||||
|
||||
while True:
|
||||
(connection , addr) = s.accept()
|
||||
print('verbindung von ',addr)
|
||||
#msg = 'Danke für das vorbeischauen!'
|
||||
bytes = connection.recv(1024)
|
||||
#msg = baba
|
||||
msg =bytes.decode('utf-8')
|
||||
#test = msg.upper()
|
||||
connection.send(msg.upper().encode('utf-8'))
|
||||
|
||||
(connection, addr) = s.accept()
|
||||
msg = 'test'
|
||||
while msg != 'STOP':
|
||||
print('verbindung von ', addr)
|
||||
bytes = connection.recv(4096)
|
||||
msg = bytes.decode('utf-8')
|
||||
msg = msg.upper()
|
||||
connection.send(msg.encode('utf-8'))
|
||||
else:
|
||||
connection.close()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user