Re: Networking and special characters.

From: Date: Sat, 08 Nov 2003 21:15:05 +0000
Subject: Re: Networking and special characters.
References: 1 2 3 4  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-4115@lists.php.net to get a copy of this message
What code are you using to CONNECT to it? It would hang, if you did a while loop. I advise using gtk::timeout_add() with around a 500-1000 MS timeout, that checks for if($con = sockaccept()) etc. Look up timeout add in misc gtk functions refference. "Adam Jimenez" <adam@bantha.co.uk> wrote in message news:20031108170550.43383.qmail@pb1.pair.com... > Ok, I'm trying to use this function to listen for connections: > > function listen() > { > global $label,$sock; > > $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); // Create our > socket. > socket_bind($socket,'localhost',1337); //bind the socket to our IP address, > on port 1337. > socket_listen($socket); // listen for any incoming connections > while($connection = socket_accept($socket)) // accept any incoming > connection and write to the socket. > { > socket_write($connection,'You\'ve successfully connected to my > computer!\r\n'); > } > > } > > Everything seems fine until it gets to 'socket_accept($socket)'. > The program then hangs. > > What am I doing wrong? > > Thanks, > > Adam

« previous php.gtk.general (#4115) next »