php open_socket
        Posted  
        
            by sea_1987
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by sea_1987
        
        
        
        Published on 2010-04-30T13:46:20Z
        Indexed on 
            2010/04/30
            13:47 UTC
        
        
        Read the original article
        Hit count: 293
        
Hello, I am trying to open a socket to use with secure tradings xpay api, however when I check to see if the socket is open I get error returned,
Can't assign requested address
I need to open up 127.0.0.1:5000 is there something wring with my code that means I cannot do this?
if (isset($xpay_port) and
              ($socket=socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) and
              (socket_connect($socket, $address, $port)))
            {
              $text="Connection successful on IP $address, port $port";
              socket_close($socket);
            }
          else
            $text="Unable to connect<pre>".socket_strerror(socket_last_error())."</pre>";
          echo "<html><head></head><body>".
               $text.
               "</body></html>";
© Stack Overflow or respective owner