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);

I copied the scripts over to another computer that's running IIS/PHP
in Windows XPPro - an identical setup. However, the socket fails to
connect. After some 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?

FWIW, I had this exact same problem when I tried this same thing about
a year ago on a box running Vista. I chalked it up at that time to
there being something wierd about Vista. But that doesn't explain it
this time.

And, BTW, the value of $_SERVER['SERVER_NAME'] is the same on both
computers ("localhost"). And, both of these computers are operating on
my own LAN. And, there are no firewalls running on either one.


.



Relevant Pages

  • Re: Socket connection issue
    ... It opens a socket connection to a process ... I copied the scripts over to another computer that's running IIS/PHP ... in Windows XPPro - an identical setup. ... a year ago on a box running Vista. ...
    (comp.lang.php)
  • Can I update processor?
    ... I'd appreciate guidance if poss.either with a reply or perhaps sending me to the newsgroup that can answer it. ... I have a Dell Inspiron 530 running Vista home basic with: ... Socket/Slot socket 775 ...
    (microsoft.public.windows.vista.general)