Solved

Error in fsockopen() URGENT!!!

Posted on 2006-06-29
8
223 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: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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

828 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