Compare commits
2
Commits
fbffbfe332
...
b3d7b7212b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3d7b7212b | ||
|
|
7c4ae69817 |
No files matched your search
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,16 @@
|
||||
import socket
|
||||
|
||||
myclient = socket.socket()
|
||||
hostname = socket.gethostname()
|
||||
port = 22445
|
||||
|
||||
myclient.connect((hostname, port))
|
||||
|
||||
msg_to_server = input("Aufgabe 1: Bitte geben Sie eine Nachricht ein: ")
|
||||
|
||||
myclient.send(msg_to_server.encode('utf-8'))
|
||||
converted_msg = myclient.recv(1024)
|
||||
print("Erhaltener string: ", converted_msg.decode('utf-8'))
|
||||
|
||||
myclient.close()
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import socket
|
||||
|
||||
myserver = socket.socket()
|
||||
hostname = socket.gethostname()
|
||||
port = 22445
|
||||
myserver.bind((hostname, port))
|
||||
myserver.listen()
|
||||
|
||||
(connection, addr) = myserver.accept()
|
||||
msg_from_client = connection.recv(1024).decode('utf-8')
|
||||
in_capital_letters = msg_from_client.upper()
|
||||
connection.send(in_capital_letters.encode('utf-8'))
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import socket
|
||||
|
||||
myclient = socket.socket()
|
||||
hostname = socket.gethostname()
|
||||
port = 33221
|
||||
|
||||
myclient.connect((hostname, port))
|
||||
|
||||
while True:
|
||||
msg_to_server = input("Aufgabe 2: Bitte geben Sie eine Nachricht ein: ")
|
||||
|
||||
if msg_to_server != "STOP":
|
||||
myclient.send(msg_to_server.encode('utf-8'))
|
||||
converted_msg = myclient.recv(1024).decode('utf-8')
|
||||
print("Erhaltener string: ", converted_msg)
|
||||
else:
|
||||
myclient.close()
|
||||
break
|
||||
@@ -0,0 +1,14 @@
|
||||
import socket
|
||||
|
||||
myserver = socket.socket()
|
||||
hostname = socket.gethostname()
|
||||
port = 33221
|
||||
myserver.bind((hostname, port))
|
||||
myserver.listen()
|
||||
|
||||
(connection, addr) = myserver.accept()
|
||||
|
||||
while True:
|
||||
msg_from_client = connection.recv(1024).decode('utf-8')
|
||||
in_capital_letters = msg_from_client.upper()
|
||||
connection.send(in_capital_letters.encode('utf-8'))
|
||||
Reference in new issue
Block a user