socket 网络中断
作者:互联网
node2:/root/test#cat t200.py
# coding = utf-8
# -*- coding:utf-8 -*-
import socket
import time
import datetime
ip_port = ('192.168.137.3',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----------------';
print s.getsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF)
print s.getsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF)
#s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 0)
s.b
标签:getsockopt,SOCKET,中断,SOL,网络,SO,print,socket 来源: https://blog.csdn.net/zhaoyangjian724/article/details/122784466