Last active
February 7, 2019 12:01
-
-
Save songritk/8b0a07008044c49d62527591a14fc23e to your computer and use it in GitHub Desktop.
ตัวอย่าง server เปลี่ยนข้อความตัวอักษรเป็นตัวพิมพ์ใหญ่ สำหรับการเรียนวิชา Computer Networks, NPU Computer Engineer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from socket import * | |
serverPort = 12002 | |
serverSocket = socket(AF_INET, SOCK_DGRAM) | |
serverSocket.bind(('', serverPort)) | |
print ("The server is ready to receive") | |
while True: | |
message, clientAddress = serverSocket.recvfrom(2048) | |
modifiedMessage = message.decode().upper() | |
serverSocket.sendto(modifiedMessage.encode(), clientAddress) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment