Trouble with socket-server on AMD64
| From: | Kasper Johansen | Date: | Mon, 28 Apr 2008 09:08:44 +0000 |
| Subject: | Trouble with socket-server on AMD64 | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-8246@lists.php.net to get a copy of this message | ||
Hi.
I just changed my OS to Ubuntu Hardy AMD64 instead of Ubuntu Hardy I386. Suddenly an socket-server-application that was working fine on I386, doesnt work as expected on AMD64.
The problem is with this code:
<?
$this->socket = stream_socket_server("tcp://" . $this->ip . ":" . $this->port) or die("Could not open socket on port " . $this->port . ".\n");
$this->watch = Gtk::io_add_watch($this->socket, GObject::IO_IN, array($this, "socketAccept"));
?>
As soon as the "watcher" is set, the function "socketAccept()" will be called - even though there is no connection to the socket. This causes the code to hang, because "socketAccept()" runs this command:
<?
$client_socket = stream_socket_accept($this->socket);
?>
I have recompiled my PHP-GTK like 3 or 4 times now with the same result.
Has anyone else experienced or fixed this problem?
--
Regards
Kasper Johansen