socket

 

#!/usr/bin/python3           # This is client.py file

import socket

# create a socket object
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 

# get local machine name
host = socket.gethostname()

port = 8088

# connection to hostname on the port.
s.connect((host, port))

# Receive no more than 1024 bytes
msg = s.recv(1024)

s.close()

print (msg.decode('utf-8'))

 

posted @ 2019-01-09 18:47  anobscureretreat  阅读(155)  评论(0编辑  收藏  举报