Browse Source

Merge branch 'master' of https://git.efi.th-nuernberg.de/gitea/winklejo65774/Repo_fuer_mEIM_Semester7

* 'master' of https://git.efi.th-nuernberg.de/gitea/winklejo65774/Repo_fuer_mEIM_Semester7:
  Endstand Aufgabe 1 und Aufgabe 2
  Zwischenstand Server- und Clientinitialisierung (Verbindung funktioniert noch nicht)
master
Jonka Winkle 5 years ago
parent
commit
a2b00b7801

AB1_Aufg2.py → Python-Blockkurs/AB1_Aufg2.py View File


AB1_Aufg3.py → Python-Blockkurs/AB1_Aufg3.py View File


AB1_Aufg4.py → Python-Blockkurs/AB1_Aufg4.py View File


AB1_Aufg5.py → Python-Blockkurs/AB1_Aufg5.py View File


Arbeitsblatt01.pdf → Python-Blockkurs/Arbeitsblatt01.pdf View File


Arbeitsblatt02.pdf → Python-Blockkurs/Arbeitsblatt02.pdf View File


FirstProgram.py → Python-Blockkurs/FirstProgram.py View File


Pong.py → Python-Blockkurs/Pong.py View File


README.md → Python-Blockkurs/README.md View File


Tag2_EigenesSpiel.py → Python-Blockkurs/Tag2_EigenesSpiel.py View File


Tag2_MittelwertAusVariablerAnzahlParameter.py → Python-Blockkurs/Tag2_MittelwertAusVariablerAnzahlParameter.py View File


+ 16
- 0
mEIM-Praktikum_Webentwicklung/Aufg1_Sockets_Client.py View File

@@ -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()


+ 13
- 0
mEIM-Praktikum_Webentwicklung/Aufg1_Sockets_Server.py View File

@@ -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'))


+ 18
- 0
mEIM-Praktikum_Webentwicklung/Aufg2_Sockets_Client.py View File

@@ -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

+ 14
- 0
mEIM-Praktikum_Webentwicklung/Aufg2_Sockets_Server.py View File

@@ -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'))

Loading…
Cancel
Save