Socket connection issue
- From: Martin <ironwoodcanyon@xxxxxxxxx>
- Date: Fri, 03 Apr 2009 13:57:04 -0700
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.
.
- Follow-Ups:
- Re: Socket connection issue
- From: mijn naam
- Re: Socket connection issue
- From: Jerry Stuckle
- Re: Socket connection issue
- Prev by Date: Re: Hyperlinks
- Next by Date: Re: Socket connection issue
- Previous by thread: Hyperlinks
- Next by thread: Re: Socket connection issue
- Index(es):
Relevant Pages
|