Visite Webhosting Latino, el site sobre alojamiento web.
#30454 : Socket not closed if no read/write - Mombu the Php Forum
Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #30454 : Socket not closed if no read/write
User Name
REGISTER NOW! Mark Forums Read

sponsored links

1 8th September 13:22
External User
Posts: 1
Default #30454 : Socket not closed if no read/write

ID: 30454
Updated by:
Reported By: nightcat at poczta dot onet dot pl
-Status: Open
+Status: Feedback
Bug Type: Sockets related
Operating System: Linux
PHP Version: 5.0.2
New Comment:

Please try using this CVS snapshot:

For Windows:

Previous Comments:

[2004-10-16 06:09:55] nightcat at poczta dot onet dot pl

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 do***entation).
I just removed everything between socket_accept and socket_close() and
added a counter to skip from loop after 3 connections.

Reproduce code:
do {
if (($msgsock = socket_accept($sock)) < 0) {
echo "socket_accept() failed: reason: " .
socket_strerror($msgsock) . "\n";


} while ($inc<3);

Expected result:
Program should close all used sockets and run for the second time

Actual result:
Running example from php do***entation 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
  Reply With Quote

  sponsored links


Thread Tools
Display Modes

Copyright 2006 - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -