#!/usr/bin/env python
import socket
import struct
import time
import binascii
host = '127.0.0.1' # Get local machine name
port = 5000 # Reserve a port for your service.
print 'Connecting to ', host, port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
message = 'EA68DF0102A100DF0360433a5c554c205465737420546f6f6c735c42545420352e322e315c4170706c69636174696f6e5c5375697465735c496d616765735c566973615c436f6e746163745c414456542076362e312e315c54657374436172643031202d20412e786d6c'
s.sendall(message)
data = binascii.hexlify(message).decode()
print "sent message:", data
data = s.recv(4096)
data = binascii.hexlify(data).decode()
print "received message:", data
s.close()
'收到消息'应该是十六进制形式,但它的空白如下:
received message: