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($add ress, $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. 2 1889
On Fri, 18 Apr 2008 10:09:17 -0700, Martin <ir************ @gmail.com>
wrote in <19************ *************** *****@4ax.com>:
>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($add ress, $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.
Open a command window on the Vista box and try to ping by both IP and
hostname. If pinging by hostname fails, then you have a DNS issue,
not a php issue. In that case, I'd suggest heading over to
microsoft.publi c.* and asking in a Vista group.
If pining by hostname works, perhaps it is the port that is blocked?
Check the settings in the Vista box's firewall.
--
Charles Calvert | Software Design/Development
Celtic Wolf, Inc. | Project Management http://www.celticwolf.com/ | Technical Writing
(703) 580-0210 | Research
On Fri, 18 Apr 2008 14:57:44 -0400, Charles Calvert <cb***@yahoo.co m>
wrote:
>On Fri, 18 Apr 2008 10:09:17 -0700, Martin <ir************ @gmail.com> wrote in <19************ *************** *****@4ax.com>:
>>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($add ress, $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.
Open a command window on the Vista box and try to ping by both IP and hostname. If pinging by hostname fails, then you have a DNS issue, not a php issue. In that case, I'd suggest heading over to microsoft.publ ic.* and asking in a Vista group.
If pining by hostname works, perhaps it is the port that is blocked? Check the settings in the Vista box's firewall.
Thanks Charles.
I tried what you suggested. Pinging works ok both way - IP address and
ComputerName.
You're probably correct in that something in Vista is blocking the
port. I'm not running the firewall at all. I've looked around in the
various settings in Vista but have been unable to find anything. I'll
keep digging and see if I can find anything. (stuff is buried pretty
deep in Vista)
Thanks for the tips. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: flupke |
last post by:
Hi,
I have a gui (made in wxPython) that enables a user to connect to a server
and issue some commands. The problem occurs when i try to disconnect the
client. It exits but it doesn't return to the prompt. I have to push
Ctrl-C in order to have it exit completely. The GUI is closed though.
This is a piece of code from the main class that...
|
by: Dan |
last post by:
I am working with the C-API to MYSQL Ver 12.16 Distrib 4.0.5a-beta,
for pc-linux (i686).
I have noticed the following problem. Within my C program I issue
---
conn = mysql_init(NULL);
conn = mysql_real_connect(conn,"localhost",...etc...);
if (conn == NULL)
{
|
by: Dr. J |
last post by:
I have an application that opens a socket and connects to another
application listening over a port. The problem I am encountering is that
when the listening application is closed my application cannot detect it to
take appropriate action. I am using "Connected" property of the Socket
class, but it seems this property does not reflect the...
|
by: Mr. Beck |
last post by:
Hello,
Please Help.....
I have been working with some tcp/ip socket communication within a C#
program recently. Basicly, I have a program (myProblemProgram) that has a
socket connected to another program for information passing. Upon receiving
a particular "command" from the the information passing program,
myProblemProgram will...
|
by: Arno |
last post by:
reposted with the right microsoft managed newsgroup ID: Sorry for the
inconvinience
Hi,
I've written a class for client-socket connection, but I get a lot of times
the error message "Unable to read data from the transport connection" when
restart reading the stream with socket.BeginRead in the Sub
SocketIncomingMsg. I'm debugging now for...
| |
by: Sean |
last post by:
Hi Everyone,
My apologies for a somewhat dump question but I am really stuck. I have
been working on this code for two days straight I am dont know what is
wrong with it. when I run the code, All I get is Input: and the program
quits. I also tried reading this online but I didn't quite get it.
What is the diff between sin_addr and...
|
by: darthghandi |
last post by:
I've created a class to listen to all interfaces and do a
BeginAccept(). Once it gets a connection, it passes the connected
socket off and stores it in a List. Next, it continues to listen for
more incoming connections and does the BeginAccpet() again. It does
an infinite loop this way. My question is: What is the best way to
stop this? ...
|
by: manasap |
last post by:
Hi all!
I've written a server and a client application using asynchronous sockets.The client sends data packets for every 7 seconds.The server receives the packets.
This process proceeds smoothly without any errors but,sometimes I get the following error.
"An existing connection was forcibly closed by the remote host."
Why is...
|
by: Nicolas Le Gland |
last post by:
Hello everyone here.
This is my first post in this newsgroup, I hope I won't be to much
off-topic. Feel free to redirect me to any better group.
I am getting strange timing issues when failing to asynchronously connect
sockets on closed or filtered ports, but I'm quite unsure if this is a PHP
issue or my misunderstanding, as it seems...
|
by: A. W. Dunstan |
last post by:
I'm creating a socket as follows:
m_networkSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
m_networkSocket.LingerState = new LingerOption(true, 1);
m_networkSocket.Blocking = true;
m_networkSocket.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.NoDelay, true);...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |