PHP Classes

socket program problem

Recommend this page to a friend!

      cls Socket  >  All threads  >  socket program problem  >  (Un) Subscribe thread alerts  
Subject:socket program problem
Summary:undefined funtion socket_create()
Messages:3
Author:sriram
Date:2008-03-20 07:10:26
Update:2009-05-20 10:27:43
 

 


  1. socket program problem   Reply   Report abuse  
Picture of sriram 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.

  2. Re: socket program problem   Reply   Report abuse  
Picture of jayaprakash_shirva jayaprakash_shirva - 2008-06-30 06:09:40 - In reply to message 1 from sriram
sir,

i am also facing a similar problem.
when i searched google, i found an answer stating that uncommenting the extension = php_sockets.dll line in php.ini will solve the problem. however, inspite of doing the same, the problem has not got solved.

i am also using wamp 2.

  3. Re: socket program problem   Reply   Report abuse  
Picture of serkan temizel serkan temizel - 2009-05-20 10:27:43 - In reply to message 1 from sriram
yes I have the same problem also any solutions?

 
For more information send a message to info at phpclasses dot org.