系统提供的socket缓冲区大小为8K,你可以将之设置为64K,尤其在传输实时视频时。 //设置发送和接收缓冲区
int rcvbuf;
int rcvbufsize=sizeof(int);
if(getsockopt(m_Socket,SOL_SOCKET,SO_RCVBUF,(char*)
&rcvbuf,&rcvbufsize)!=SOCKET_ERROR)
{
if(rcvbuf<65536)
rcvbuf=65536;
setsockopt(m_Socket,SOL_SOCKET,SO_RCVBUF,(char*)
&rcvbuf,rcvbufsize);
}
if(getsockopt(m_Socket,SOL_SOCKET,SO_SNDBUF,(char*)
&rcvbuf,&rcvbufsize)!=SOCKET_ERROR)
{
if(rcvbuf<65536)
rcvbuf=65536;
setsockopt(m_Socket,SOL_SOCKET,SO_SNDBUF,(char*)
&rcvbuf,rcvbufsize);
} 转载自:http://hi.baidu.com/auleaf/blog/item/a064a122d501
...
继续阅读
(8)