note 123753 added to function.socket-set-option
| From: | renmengyang567 at gmail dot com | Date: | Sun, 07 Apr 2019 10:04:46 +0000 |
| Subject: | note 123753 added to function.socket-set-option | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-210540@lists.php.net to get a copy of this message | ||
<question>
Why is the size of the buffer 2 times that set by me?
<?php
//Before setting the cache area
$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);
//After setting the cache area
$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);
?>
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.142 (proxied: 104.199.167.217)
----
Manual Page -- http://php.net/manual/en/function.socket-set-option.php
Edit -- https://master.php.net/note/edit/123753
Del: integrated -- https://master.php.net/note/delete/123753/integrated
Del: useless -- https://master.php.net/note/delete/123753/useless
Del: bad code -- https://master.php.net/note/delete/123753/bad+code
Del: spam -- https://master.php.net/note/delete/123753/spam
Del: non-english -- https://master.php.net/note/delete/123753/non-english
Del: in docs -- https://master.php.net/note/delete/123753/in+docs
Del: other reasons-- https://master.php.net/note/delete/123753
Reject -- https://master.php.net/note/reject/123753
Search -- https://master.php.net/manage/user-notes.php