Click here to Skip to main content
11,409,854 members (60,311 online)
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 Sergey Alexandrovich Kryukov 270
1 OriginalGriff 255
2 Maciej Los 138
3 Andy Lanng 115
4 Sascha Lefévre 85
0 Sergey Alexandrovich Kryukov 8,731
1 OriginalGriff 6,895
2 Maciej Los 3,332
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web04 | 2.8.150414.5 | Last Updated 9 Sep 2012
Copyright © CodeProject, 1999-2015
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