#server.py
print 'enter socket ...'
import socket
s = socket.socket()
host = socket.gethostname()
port = 12345
s.bind((host, port))
s.listen(5)
while True:
c, addr = s.accept()
print 'addr=', addr
data = c.recv(1024)
data = data.strip('[').strip(']').split(',')
data = map(eval, data)
print type(data),len(data),data
print type(data[0]),data[0]
#c.send('helloworld!')
c.close()
print 'exit socket ...'
#clint.py
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# 文件名:client.py
import socket # 导入 socket 模块
s = socket.socket() # 创建 socket 对象
host = socket.gethostname() # 获取本地主机名
port = 12345 # 设置端口号
s.connect((host, port))
import math
angle=[math.pi/3,math.pi/3,math.pi/3,math.pi/3,math.pi/3,math.pi/3]
print type(angle),len(angle),angle
print type(angle[0]),angle[0]
s.send(bytes(angle))
#print s.recv(1024)
s.close()