关于socket——SO_SNDBUF and SO_RECVBUF
转自:http://blog.csdn.net/wf1982/article/details/38871521
参见 http://stackoverflow.com/questions/4257410/what-are-so-sndbuf-and-so-recvbuf
The "SO_" prefix is for "socket option", so yes, these are per-socket settings for the per-socket buffers. There are usually system-wide defaults and maximum values.
SO_RCVBUF is simpler to understand: it's the size of the buffer the kernel allocates to hold the data arriving into the given socket during the time between it arrives over the network and when it is read by the program that owns this socket. With TCP, if data arrives and you aren't reading it, the buffer will fill up, and the sender will be told to slow down (using TCP window adjustment mechanism). For UDP, once the buffer is full, new packets will just be discarded.
SO_SNDBUF, I think, only matters for TCP (in UDP, whatever you send goes directly out to the network). For TCP, you could fill the buffer either if the remote side isn't reading (so that remote buffer becomes full, then TCP communicates this fact to your kernel, and your kernel stops sending data, instead accumulating it in the local buffer until it fills up). Or it could fill up if there is a network problem, and the kernel isn't getting acknowledgements for the data it sends. It will then slow down sending data on the network until, eventually, the outgoing buffer fills up. If so, future write() calls to this socket by the application will block (or return EAGAIN if you've set the O_NONBLOCK option).
关于socket——SO_SNDBUF and SO_RECVBUF的更多相关文章
- python - socket - connection
前面有了TCP server和TCP client.在这个文章中我们建立tcp连接并且进行数据的发送. 例子,经常用到的echo功能.TCP client连接到server, 向server发送mes ...
- Python3的tcp socket接收不定长数据包接收到的数据不全。
Python Socket API参考出处:http://blog.csdn.net/xiangpingli/article/details/47706707 使用socket.recv(pack_l ...
- 百万年薪python之路 -- socket()模块的用法
socket()模块的用法: import socket socket.socket(socket_family,socket_type,protocal=0) socket_family 可以是 A ...
- day8 socket
代码: 例子1:socket tcp 通讯 server端 import socketserver = socket.socket()ip_port = ("127.0.0.1", ...
- python socket理解
socket 所谓套接字(Socket),就是对网络中不同主机上的应用进程之间进行双向通信的端点的抽象.一个套接字就是网络上进程通信的一端,提供了应用层进程利用网络协议交换数据的机制.从所处的地位来讲 ...
- Python网络编程——修改套接字发送和接收的缓冲区大小
很多情况下,默认的套接字缓冲区大小可能不够用.此时,可以将默认的套接字缓冲区大小改成一个更合适的值. 1. 代码 # ! /usr/bin/env python # -*- coding: utf-8 ...
- Netty Tutorial Part 1.5: On Channel Handlers and Channel Options [z]
Intro: After some feedback on Part 1, and being prompted by some stackoverflow questions, I want to ...
- python网络编程应用(一)
在之前的一篇博客<python网络编程基础>中介绍了socket.socket()函数及其应用,其实socket模块中还有很多属性可供网络应用程序使用.这里将详细讲解一下socket模块 ...
- python网络编程详解
最近在看<UNIX网络编程 卷1>和<FREEBSD操作系统设计与实现>这两本书,我重点关注了TCP协议相关的内容,结合自己后台开发的经验,写下这篇文章,一方面是为了帮助有需要 ...
随机推荐
- Java中 final static super this instanceof 关键字用法
一.final关键字 final可以修饰变量.方法及类: 1.当定义一个final变量时,jvm会将其分配到常量池中,其所修饰的对象只能赋值一次,对基本类型来说是其值不可变,引用类型(包括作为函数形参 ...
- Wince下sqlce数据库开发(二)
上次写到使用数据绑定的方法测试本地sqlce数据库,这次使用访问SQL Server的方法访问sqlce,你会发现他们是如此的相似... 参考资料:http://www.cnblogs.com/rai ...
- poj 1276
一道DP的题目,还是一道多重背包的题目,第一次接触. 题意:有现今cash,和n种钱币,每种钱币有ni个,价值为di,求各种钱币组成的不超过cash的最大钱数 思路:可以转换为0/1背包和完全背包来做 ...
- ios 引入第三方库 运行时找不到函数实现
今天引入webtrends 这个库,结果一直运行时找不到函数,纳闷了一下午! 后来发现,是other flag没有设置对,对于那些包含category用来扩展ios原始类型的库,链接的时候需要特别的链 ...
- locustio压力测试
2015年7月17日 22:19:17 星期五 这里记录下学习道路, 防止忘了 操作系统是centos: 首先是linux系统, 装有Python 和 Python-devel (否则安装软件会提示p ...
- jquery中使用event.target的几点
jquery中使用event.target的几点 1.this和event.target的区别: js中事件是会冒泡的,所以this是可以变化的,但event.target不会变化,它永远是直接接受事 ...
- OKhttp的封装(下)
OKhttpManager2.Class 请求工具类 package com.example.administrator.okhttp3; import android.os.Handler; im ...
- Hibernate单向一对多对象关系模型映射
1 hibernate 的对象关系映射 Orm: 类-----表 属性------字段 对象------记录 表:在数据库中存在主外键的关系,反向工厂类是由表生成,在由表生成类的时候,类和类之间存在者 ...
- library not found for -lAFNetworking
错误内容如图所示: error:linker command failed with exit code 1(use -v to see invocation) 首先报这个错的情况有很多,所以需要看e ...
- Windows Form 中快捷键设置
在Windows Form程序中使用带下划线的快捷键只需要进行设置: 就能够工作.