Page 91 - Python Cơ Bản
P. 91
8ϰS JMPI client.py ZЪM RШM HYRK FɱR HЪM
import socket
s = socket.socket()
host = '127.0.0.1'
port = 12345
s.connect((host, port))
print s.recv(1024)
s.close
ɇSϰR GSHI XVɱR WЌ OЎX RРM чЎR QШX WSGOIX WIVZIV XLɺRK
UYE LSWXREQI Pϴ] чвG Xк TLRK XLиG
socket.gethostname() Zɧ TSVX 7EY OLM OЎX RРM WЌ
LMВR XLК VE OЎX UYϲ XVϲ ZА Xк WIVZIV 7EY чɹ XLɳ чɹRK OЎX RРM