node2:/root/test#cat connect2.py
# -*- coding: utf-8 -*-
import socket
import time
import datetime
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.settimeout(30)
s.connect(("192.168.137.2",8080))
print datetime.datetime.now()
s.send('111111111111111111111111111')
time.sleep(10)
print s.recv(90)
print datetime.datetime.now()
node1:/root/test#cat t200.py
# coding = utf-8
# -*- coding:utf-8 -*-
import socket
import time
import datetime
ip_port = ('192.168.137.2',8080)
BUFSIZE = 9000
SEND_BUF_SIZE = 200
RECV_BUF_SIZE = 100
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)#创建套接字
print