note 44021 rejected from function.socket-accept by tomsommer

From: Date: Mon, 12 Jul 2004 19:54:22 +0000
Subject: note 44021 rejected from function.socket-accept by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-73115@lists.php.net to get a copy of this message
Note Submitter: gn_mnit@yahoo.com ---- i'm new to php, can anyone help me on this 'server socket' <?php $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); // Create our socket. socket_bind($socket,'localhost',15000); //bind the socket to our IP address, on port ....... 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'); $res=socket_recv($socket,$buffer,1024,0); if ($res<=0){ echo "error"; } else echo $res; } socket_close( $socket ); ?> i'm getting different errors at different times, i'm stuck up. Warning: socket_bind() unable to bind address [0]: Only one usage of each socket address (protocol/network address/port) is normally permitted. in c:\apache\apache\htdocs\final\server.php on line 3 Warning: socket_listen() unable to listen on socket [0]: An invalid argument was supplied. in c:\apache\apache\htdocs\final\server.php on line 4 Warning: socket_accept() unable to accept incoming connection [0]: An invalid argument was supplied. in c:\apache\apache\htdocs\final\server.php on line 5 Warning: socket_accept() unable to accept socket connection [0]: The operation completed successfully. in c:\apache\apache\htdocs\final\server.php on line 5

« previous php.notes (#73115) next »