I am trying to connect the target written in C using PHP socket_connect() function, but I am getting the following error:
Warning: socket_connect(): unable to connect [10061]: No connection could be made because the target machine actively refused it.
This is the code what I am running:
    $service_port = 1234; 
    $address = "xx.xxx.xx.xxx";
    $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);     
    if ($socket === false) {
        echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
    } else {
        echo "OK.\n<br>";
    }       
    echo "Attempting to connect to '$address' on port '$service_port'...\n";        
    $result = socket_connect($socket, $address, $service_port);
    if ($result === false) {
        echo "socket_connect() failed.\nReason: ($result) " . socket_strerror(socket_last_error($socket)) . "\n";
    } else {
        echo "OK.\n<br>";
    }
I am using the xampp server with PHP 5.4 in Windows 7 and I have disabled the firewall settings. Still I am getting the same refused error.
Please help me to solve this issue. [I am fighting with this issue for the last 3 days]
Thanks in advance.