服务端:
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("Buffer size [Before]: %d" % s.getsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF))
print("Buffer size [Before]: %d" % s.getsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF))
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsockopt( socket.SOL_SOCKET, socket.SO_SNDBUF, SEND_BUF_SIZE)
s.setsockopt( socket.SOL_SOCKET, socket.SO_RCVBUF, RECV_BUF_SIZE)
print 'alter------