<问题>
为什么缓冲区的大小是我设置的两倍?
<?php
$sock = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
socket_bind($sock, '127.0.0.1',5000);
socket_listen($sock,1024);
$sndbuf = socket_get_option($sock,SOL_SOCKET,SO_SNDBUF);
$rcvbuf = socket_get_option($sock,SOL_SOCKET,SO_RCVBUF);
printf("发送缓冲区大小(写缓存区大小):%sm \n",$sndbuf/1024);
printf("接收缓冲区大小(读缓存区大小)%sm \n",$rcvbuf/1024);
$snd_buf = 1024*3;
$rcv_buf = 1024*3;
socket_set_option($sock,SOL_SOCKET,SO_SNDBUF, $snd_buf);
socket_set_option($sock,SOL_SOCKET,SO_RCVBUF, $rcv_buf);
$sndbuf = socket_get_option($sock,SOL_SOCKET,SO_SNDBUF);
$rcvbuf = socket_get_option($sock,SOL_SOCKET,SO_RCVBUF);
printf("发送缓冲区大小(写缓存区大小):%sm \n",$sndbuf/1024);
printf("接收缓冲区大小(读缓存区大小)%sm \n",$rcvbuf/1024);
?>