#30454 [Fbk->NoF]: Socket not closed if no read/write
| From: | php-bugs at lists dot php dot net | Date: | Mon, 21 Feb 2005 00:00:07 +0000 |
| Subject: | #30454 [Fbk->NoF]: Socket not closed if no read/write | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76974@lists.php.net to get a copy of this message | ||
ID: 30454
Updated by: php-bugs@lists.php.net
Reported By: nightcat at poczta dot onet dot pl
-Status: Feedback
+Status: No Feedback
Bug Type: Sockets related
Operating System: Linux
PHP Version: 5.0.2
New Comment:
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
Previous Comments:
------------------------------------------------------------------------
[2005-02-13 15:00:22] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.0-win32-latest.zip
------------------------------------------------------------------------
[2004-10-16 06:09:55] nightcat at poczta dot onet dot pl
Description:
------------
I'm playing with Socket support in PHP 5, and found something weird.
I was writing my own classess for Socket support and done a base:
1) create serversocket
2) create clientsocket on serversocket->accept()
3) close clientsocket
4) close serversocket
but if between point 2 and 3 there was no read/write for socket, next
try to start a program ended an error.
Below here is a part of code for server (from php documentation).
I just removed everything between socket_accept and socket_close() and
added a counter to skip from loop after 3 connections.
Reproduce code:
---------------
$inc=0;
do {
if (($msgsock = socket_accept($sock)) < 0) {
echo "socket_accept() failed: reason: " .
socket_strerror($msgsock) . "\n";
break;
}
socket_close($msgsock);
$inc++;
} while ($inc<3);
Expected result:
----------------
Program should close all used sockets and run for the second time
normally.
Actual result:
--------------
Running example from php documentation with the msgsocket part switched
with provieded example for the second time results in
Warning: socket_bind(): unable to bind address [98]: Address already in
use in /server/www/data/thot/tests/simple-server.php on line 19
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30454&edit=1