<question>
Why is the size of the buffer 2 times that set by me?
<?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("send buffer size(写缓存区大小):%sm \n",$sndbuf/1024);
printf("receive buffer(读缓存区大小)%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("send buffer size(写缓存区大小):%sm \n",$sndbuf/1024);
printf("receive buffer size(读缓存区大小)%sm \n",$rcvbuf/1024);
?>