Here is the code per your request



// defaults...
define('MAXLINE', 1024);        // how much to read from a socket at a time
define('LISTENQ', 10);          // listening queue
$PORT = 1482;                  // the default port to run on
$FD_SETSIZE = 5;               // file descriptor set size (max number of
concurrent clients)...


mysql_query("DELETE FROM livechat");  //delete all old records left over
from a possible server crash or other anomoly

// set up the file descriptors and sockets...

// $listenfd only listens for a connection, it doesn't handle anything
// but initial connections, after which the $client array takes over...

$allset = socket_fd_alloc();
$listenfd = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($listenfd)
{ print "Listening on port $PORT\n"; }
{ die("AIEE -- socket died!\n"); }

socket_setopt($listenfd, SOL_SOCKET, SO_REUSEADDR, 1);
if (!socket_bind($listenfd, '', $PORT))
    die("AIEE -- Couldn't bind!\n");
socket_listen($listenfd, LISTENQ);

// set up our clients. After listenfd receives a connection,
// the connection is handed off to a $client[].

-----Original Message-----
From: Andrew Brampton [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 21, 2002 9:42 AM
To: David Buerer
Subject: Re: [PHP] unable to lookup host [1001] error

Show the code and we might be able to help better...
maybe line 20-35 ish, or anything you feel useful

----- Original Message -----
From: "David Buerer" <[EMAIL PROTECTED]>
Sent: Wednesday, August 21, 2002 3:39 PM
Subject: [PHP] unable to lookup host [1001] error

> Anyone ever seen this error before?  What causes it?  It happens on a call
> to socket_bind after a successful call to socket_listen.
> Any ideas would be appreciated.
> Warning: socket_bind() unable to lookup host [1001]: Recursion too deep,
> stack overflowed. in
> f:\public\www\josiah\josiah2\consultation\chat\test_server.php on line 31
> AIEE -- Couldn't bind!

Reply via email to