sriram - 2008-03-20 07:10:26
hi there.
i'm trying to write a php program to send messages to the machines connected on LAN. the program is like this,
<?php
$host="192.168.1.7";
$port=1234;
set_time_limit(0);
$socket=socket_create(AF_INET,SOCK_STREAM,0) or die("Could not create socket");
$result=socket_bind($socket,$host,$port) or die("Could not bind to socket");
$result=socket_listen($socket,3) or die("Could not setup socket listener");
echo "Waiting for connections...\n";
$spawn=socket_accept($socket) or die("Could not accept incoming connection");
$input=socket_read($spawn,1024) or die("Could not read input");
$input=trim($input);
$output=strrev($input)."\n";
socket_write($spawn,$output,strlen($output)) or die("Could not write output");
socket_close($spawn);
socket_close($socket);
?>
but it gives an error message:Fatal error: Call to undefined function socket_create() in C:\wamp\www\SRI\Socket\socket.php on line 5.
I'm using WAMP 5. I've uncommented the ;extension=php_sockets.dll by deleting the preceding semicolon.
pls help me as early as possible.