The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

socket_connect() unable to connect [111]

Discussion in 'General Discussion' started by SACHIN, Jan 28, 2007.

  1. SACHIN

    SACHIN Guest

    Hello,

    We are facing the following error for one website

    Warning: socket_connect() unable to connect [111]: Connection refused in /home/pakmasti/public_html/sms/ufone.php on line 45
    Sock_Error: Socket was unable to bind.


    The necessary code for ufone.php is as follows:
    ========================================================
    <?php

    /*Your msg*/
    $idiot=" *www.domain.org*";

    $address = "216.240.157.53";
    $port = 5000;
    $socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);

    if (!socket_connect($socket,$address,$port)) {
    socket_close($socket);
    die("Sock_Error: Socket was unable to bind.\n");
    }


    $res=socket_recv($socket,$buf,20,0);

    for($i=0;$i<=strlen($buf);$i++)
    {
    if($i>10)
    $id.=$buf[$i];
    }

    $d=sprintf("ID_RECIVED 0 0 0 0 %s wht",$id);


    socket_write($socket,$d,strlen($d));
    $msgfin=sprintf("Message MobileServer %s 0 %s %s: %s%s",$_POST['num'],$id,$_POST['nick'],$_POST['message'],$idiot);

    socket_write($socket,$msgfin,strlen($msgfin));
    socket_close($socket);

    echo "";

    ?>
    ====================================================

    I have opened the port 5000 on the server. The port is opened for the TCP and for UDP. The firewall have the access for the port 5000 and firewall is not blocking this port.

    Waiting for the reply.

    Sachin.
     
Loading...

Share This Page