Click here to Skip to main content
12,949,601 members (62,208 online)
Rate this:
 
Please Sign up or sign in to vote.
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)

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 5-Sep-12 7:33am

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,489
CHill60 3,380
Maciej Los 2,913
Jochen Arndt 1,935
ppolymorphe 1,820


Advertise | Privacy | Mobile
Web02 | 2.8.170524.1 | Last Updated 9 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100