Solved

Error in fsockopen() URGENT!!!

Posted on 2006-06-29
8
224 Views
Last Modified: 2013-12-12
Hi!

I'm trying to use the following code:

$this->socket = fsockopen($this->server,$this->port, $errno, $errstr, $timeout = 300) or die($errstr);

It is running well in localhost but when I'm trying to run it in remote server then it is giving the following error:

Warning: fsockopen(): unable to connect to demo.demo.com:1863 in /home/demo/public_html/demo/demo/demo/demo.php on line 123
Connection timed out

I have also checked that whether the server is enabled for socket. But I found it is enabled in the server.

Can anybody help me to know what is the reason behind the connection timeout?

Thanks in advance...
Funtus.
0
Comment
Question by:funtus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 17010170
The MSN Messanger port may well be open, but if there is no application running on the server to handle it (and why would MSN be running on the server???!!!!), then you are not going to get a response.

0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 17010185
By open I mean not blocked. Not quite the same thing as open really.

Just because the firewall is NOT blocking it, doesn't mean it is opened.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 17010191
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 2

Author Comment

by:funtus
ID: 17010354
Hi!

Thanks for the response.

But I could not understand what do u mean by "if there is no application running on the server to handle it... ".

I'm trying to import msn address list to myserver.

If so then why it is running in localhost?

Kindly advice...
Funtus.
0
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 500 total points
ID: 17016086
You are trying to open port 1863. This is the port handled by MSN. If MSN is not running, you have nothing to comminicate with.

Take this easier example.

You have a webserver running on your local computer. All things being normal, you would access port 80 on 127.0.0.1 to talk to your web server.

Now, say that works. Port 80 is open and available.

Now. Making no changes to a firewall or any security settings, close the webserver.

You've not hidden port 80, but if you try to browser, you will get a host not found error. Port 80 is NOT the issue. The application which handles port 80 (your web server) is not running. So no communication and eventually a time out.

This is the same for any port. The ports don't have a "magical" handler behind them.

Easier example.

You leave your house and you don't have an answering machine. Some calls. Phone rings. And rings and rings. Eventually the the other person will get bored and hang up - timeout.

See?

0
 
LVL 2

Author Comment

by:funtus
ID: 17492286
Hi!

I actually was trying to import msn address list with the help of a downloaded class. I found a post in that class forum which says:

****
Warning: fsockopen(): unable to connect to http://messenger.hotmail.com:1863

That's because you firewall is blocking port 1863.

(if you don't have root access to the server, then tell your administrator to allow traffict trough port 1863.)
****

So I have asked webadmin to allow traffic through port 1863.

Can you tell me what does it mean?

Thanks,
Funtus.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 17492314
A port is like a door. Each door can have a doorman (controlled by the firewall).

You've come to the door asking to be let in. Your name is NOT on the list. You are NOT getting in. Or out!

"Configuring the firewall" is like "putting your name on the list".

Once configured, you are allowed to open that door.

But the door is really a tunnel. At the other end of the tunnel is another door. That door also has a doorman. You may find that that door actually directs you to another door with another doorman. And on it goes.

Normally, if you can use the normal software to talk to the required service, you can use PHP to do the same.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question