Skip to content

Instantly share code, notes, and snippets.

@songritk
Created February 7, 2019 11:51
Show Gist options
  • Save songritk/1d283ce0eb67653f92541e9e973b1c17 to your computer and use it in GitHub Desktop.
Save songritk/1d283ce0eb67653f92541e9e973b1c17 to your computer and use it in GitHub Desktop.
ตัวอย่าง client เปลี่ยนข้อความตัวอักษรเป็นตัวพิมพ์ใหญ่ สำหรับการเรียนวิชา Computer Networks, NPU Computer Engineer
#!/usr/bin/env python3
from socket import *
serverName='127.0.0.1'
serverPort=12002
clisock=socket(AF_INET,SOCK_DGRAM)
mesg=input('Input lowercase sentence:')
clisock.sendto(mesg.encode(),(serverName, serverPort))
modifiedMessage, serverAddress = clisock.recvfrom(2048)
print(modifiedMessage.decode())
clisock.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment