Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: PHP socket IPC
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 8:33am

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

  Print Answers RSS
0 OriginalGriff 280
1 Sergey Alexandrovich Kryukov 279
2 CPallini 205
3 Maciej Los 197
4 Afzaal Ahmad Zeeshan 160
0 OriginalGriff 5,635
1 DamithSL 4,496
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 9 Sep 2012
Copyright © CodeProject, 1999-2014
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