Cannot connect a PHP client socket to a VC++ server socket
Posted: Mon Jul 21, 2008 10:25 pm
Hi,
I need to connect a client socket in a PHP script to a server socket created by a C++ program on another machine (specifically, MS Visual C++ under Windows XP-64). I've been trying trying to do it for like forever now, and without much success
. I get an error message "Unable to connect to [x.x.x.x:1027] (connection timed out)".
The PHP client socket uses fsockopen():
I know it works as it should, because I can connect this client to, say, http://www.google.com (72.14.207.99:80).
The C++ server socket uses Microsoft's CAsyncSocket class or WinSock2. A client socket written with these same classes connects to this server without a hitch.
Please help, and be kind - I'm new to socket programming.
P.
I need to connect a client socket in a PHP script to a server socket created by a C++ program on another machine (specifically, MS Visual C++ under Windows XP-64). I've been trying trying to do it for like forever now, and without much success
The PHP client socket uses fsockopen():
Code: Select all
$host="tcp://x.x.x.x";
$port = 1027;
// open a client connection
$fp = fsockopen ($host, $port, $errno, $errstr, 3);
...do some send and receive...
fclose($fp);The C++ server socket uses Microsoft's CAsyncSocket class or WinSock2. A client socket written with these same classes connects to this server without a hitch.
Please help, and be kind - I'm new to socket programming.
P.