Solved

Error in fsockopen() URGENT!!!

Posted on 2006-06-29
8
219 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
  • 5
  • 2
8 Comments
 
LVL 40

Expert Comment

by:RQuadling
Comment Utility
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:RQuadling
Comment Utility
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:RQuadling
Comment Utility
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 2

Author Comment

by:funtus
Comment Utility
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:
RQuadling earned 500 total points
Comment Utility
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
Comment Utility
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:RQuadling
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now