Socket connection issue
I have the following code being used in several of my PHP scripts
(it's in an include file). It opens a socket connection to a process
that's running on the same computer that IIS/PHP is running on. The OS
is Windows XPPro. This all works fine - no problems.
$portnum = 1001;
$address = $_SERVER['SERVER_NAME'];
$socket = @fsockopen($address, $portnum, $errno, $errstr, 2);
For experimental purposes, I copied the scripts over to another
computer that's set up with IIS/PHP in Windows Vista Business. The
socket fails to connect. After much experimentation, I discovered that
if I used the server's IP address instead of the
$_SERVER['SERVER_NAME'] variable, then the socket connects just fine.
Any ideas as to why this is happening? Is it something to do with the
Vista OS? Or do I have something mis-configured?
And, BTW, the value of $_SERVER['SERVER_NAME'] is correct. And, both
of these computers are operating on my own LAN.
|