#23242 [Fbk->NoF]: socket_read(): linux "stop" with 2 or more users connected...

From: Date: Mon, 28 Apr 2003 16:45:55 +0000
Subject: #23242 [Fbk->NoF]: socket_read(): linux "stop" with 2 or more users connected...
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38623@lists.php.net to get a copy of this message
ID: 23242 Updated by: sniper@php.net Reported By: david at wups dot net -Status: Feedback +Status: No Feedback Bug Type: Sockets related Operating System: MDK 8.2 / windows xp PHP Version: 4.3.1 New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. Previous Comments: ------------------------------------------------------------------------ [2003-04-21 12:34:11] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-04-16 12:10:32] david at wups dot net I'm test this script in windows xp (PHP Version 4.3.0)....... but this script works in windows xp (ph 4.3.0) with 2 or more users connected...... however, when i try to use this same script on my linux box (mandrake 8.2 php.4.3.1)... and i can't send 2 or more messages without send a some message in another connection. (Sorry for my bad English! its powered by http://babelfish.altavista.com/ ) :) <?php ob_implicit_flush (); error_reporting (E_ALL); $address = '192.168.0.249'; $port = 1433; if (($sock = socket_create (AF_INET, SOCK_STREAM, 0)) < 0) { echo "socket_create() failed: reason: " . socket_strerror (socket_last_error()) . "\n"; exit; } if( !(socket_set_nonblock( $sock ) ) ) { echo "socket_set_nonblock()" . socket_strerror(socket_last_error()) . "\n"; exit; } if (($ret = socket_bind ($sock, $address, $port)) < 0) { echo "socket_bind() failed: reason: " . socket_strerror (socket_last_error()) . "\n"; exit; } if (($ret = socket_listen ($sock, 5)) < 0) { echo "socket_listen() failed: reason: " . socket_strerror (socket_last_error()) . "\n"; exit; } $vtSock = Array(); global $vtSock; $volta = 0; do { $msgsock = @socket_accept($sock); if (is_resource($msgsock)) { $vtSock[] = $msgsock; /* Send instructions. */ $msg = "\nWelcome! \n\r.\n\r"; socket_write($msgsock, $msg, strlen($msg)); } for ($x=0;$x<count($vtSock);$x++) { $oSock = $vtSock[$x]; if ($oSock != false) { $buf = @socket_read( $oSock, 2048 ); if (strlen($buf) > 0) { $talkback = "TELNET [$x] send: '$buf'.\n\r"; socket_write ($oSock, $talkback, strlen ($talkback)); echo "Hey server, TELNET [$x] send: $buf<br>\n"; if ($buf == 'quit') { $vtSock[$x] = false; socket_close ($oSock); } } $volta++; } } } while (true); for ($x=0;$x<$cdSock;$x++) { $oSock = $vtSock[$x]; if ($oSock != false) socket_close ($oSock); } ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23242&edit=1

« previous php.bugs (#38623) next »