Created
June 11, 2019 11:46
-
-
Save pinglunliao/5b33d42cbaed95bd60001d1a6673764b to your computer and use it in GitHub Desktop.
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/python | |
import socket | |
s = socket.socket() | |
host = socket.gethostname() # 取得目前機器名稱 | |
print(host) | |
port = 12345 # 程式的 port number | |
s.connect((host, port)) # 連線到 server | |
recvMsg = s.recv(1024) # 接收 server 傳來的訊息 | |
print( recvMsg.decode('utf-8') ) | |
s.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment