Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi PHP
when I call socket_create , it blocks and nothing happens.

Here is the code .
I copied it from php.net
I use WebMatrix , IIS Windows. (not Apachy)

PHP
error_reporting(E_ALL);
set_time_limit(0);
ob_implicit_flush(); 


$address = '192.168.0.243';         
$port = 1000;
echo "address is : $address --- <br/><br/><br/>" ;

echo "before socket_create ... <br/> " ;
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) ;
echo "after socket_create <br/> " ;
if ($sock == false) {
    echo "socket_create() failed  <br/>" ;
    echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
}
if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) {
    echo "socket_create() failed  <br/>" ;
    echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
}
echo "after socket_create() <br/> " ;

echo "before socket_bind() <br/> " ;
if (socket_bind($sock, $address, $port) === false) {
    echo "socket_bind() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n";
}
echo "after socket_bind() <br/> " ;



when I run it , it only displays:
before socket_create ...
and then nothing happens
help!
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900