Browse Source

1.termin

master
Janko Hartwig 6 years ago
parent
commit
e77996535f
2 changed files with 21 additions and 4 deletions
  1. 5
    4
      Prakt1_Socket.py
  2. 16
    0
      prakt1_socket_client

+ 5
- 4
Prakt1_Socket.py View File

@@ -1,4 +1,5 @@
import socket
import string

s = socket.socket()
host = socket.gethostname()
@@ -12,8 +13,8 @@ while True:
msg = 'Server sagt Hallo'
connection.send(msg.encode('utf-8'))
msg = connection.recv(1024)
#connection.send(msg)
msg = msg.decode('utf-8')
print(msg)
msg = (msg.decode('utf-8')).upper()
connection.send(msg.encode('utf-8'))
#msg = msg.decode('utf-8')
#print(msg)
connection.close()

+ 16
- 0
prakt1_socket_client View File

@@ -0,0 +1,16 @@
import socket

s = socket.socket()
host = socket.gethostname()
port = 21345

s.connect((host, port))
bytes = s.recv(1024)
print(bytes.decode('utf-8'))

msg = input('Hier Eingabe: ')
msg = msg.encode('utf-8')
s.send(msg)
bytes = s.recv(1024)
print(bytes.decode('utf-8'))
s.close()

Loading…
Cancel
Save