Re: Networking and special characters.

From: Date: Sat, 08 Nov 2003 17:06:52 +0000
Subject: Re: Networking and special characters.
References: 1 2 3  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-4114@lists.php.net to get a copy of this message
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 "Sky" <loner@psknet.com> wrote in message news:20031107013217.52713.qmail@pb1.pair.com... > As for the chars, I have no idea. But I have written a (semi-functional) > server and client.... I used tcp/ip sockets. I can't tell you which one is > better, as I've never used UDP, but I know that tcp/ip works. > > > "Adam Jimenez" <adam@bantha.co.uk> wrote in message > news:20031106150555.55981.qmail@pb1.pair.com... > > Have I got you all stumped with this? > > > > > > Adam. > > > > "Mailac - Bantha.Co.Uk" <adam@bantha.co.uk> wrote in message > > news:045601c3a3bd$a17aec80$0e00a8c0@adamxp... > > Hi All, > > > > I'm a bit of newbie when it comes to PHP-GTK but bear with me. I am also > > using windoze. > > > > I've been writing my first ap which is based on the card game: black jack. > > > > It's all been coming together quite well. But I've got a couple of areas > > that I'm stuck on. > > > > 1) I don't know how to display the diamond/club/heart/spade characters. > I've > > tried using chr() to no avail. If I bring up the character map there are > > definitely legit characters. But I cannot access them. > > > > 2) I would like to introduce some kind of network play. What is the best/ > > easiest protocol to use tcp/ip or udp? And how do I go about it? I have > > tried looking up some tutorials/examples to no avail. If anyone could > point > > me in the right direction I'd very grateful. > > > > Thanks, > > > > Adam

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