... | ... | @@ -194,14 +194,14 @@ try: |
|
|
# Another connection!e
|
|
|
number_con += 1
|
|
|
|
|
|
# Print the conection number
|
|
|
# Print the connection number
|
|
|
print("CONNECTION: {}. From the IP: {}".format(number_con, address))
|
|
|
|
|
|
# Read the message from the client, if any
|
|
|
msg = clientsocket.recv(2048).decode("utf-8")
|
|
|
print("Message from client: {}".format(msg))
|
|
|
|
|
|
# Send the messag
|
|
|
# Send the message
|
|
|
message = "Hello from the teacher's server\n"
|
|
|
send_bytes = str.encode(message)
|
|
|
# We must write bytes, not a string
|
... | ... | @@ -209,7 +209,7 @@ try: |
|
|
clientsocket.close()
|
|
|
|
|
|
except socket.error:
|
|
|
print("Problems using port {}. Do you have permission?".format(PORT))
|
|
|
print("Problems using ip {} port {}. Is the IP correct? Do you have port permission?".format(IP, PORT))
|
|
|
|
|
|
except KeyboardInterrupt:
|
|
|
print("Server stopped by the user")
|
... | ... | |