aspose file tools*
The moose likes Java Micro Edition and the fly likes java.net.ConnectException: Connection timed out Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "java.net.ConnectException: Connection timed out" Watch "java.net.ConnectException: Connection timed out" New topic
Author

java.net.ConnectException: Connection timed out

lakshman kumar
Greenhorn

Joined: Dec 03, 2008
Posts: 3
hi all,
I am unable to get the response from the server for particular IP address.I tried with another URL in my program working very well when the IP address of that server is changed
i am getting the following exception java.net.ConnectException: Connection timed out.can anybody please let me know the possibilities that leads to this exception, so that i can change the settings in my midlet.
I can undoubtably say that the problem is with the server not with the midlet.
expecting the soon response from you people
lakshman
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

"laksh killer" please check your private messages for an important administrative matter. You can see them by clicking the My Private Messages link above.


SCJP, SCWCD.
|Asking Good Questions|
Rajaraja Chozhan
Greenhorn

Joined: Dec 03, 2008
Posts: 4
public class ConnectException extends SocketException

It just signals that an error occurred while attempting to connect a socket to a remote address and port. Typically, the connection was refused remotely (e.g., no process is listening on the remote address/port). Or a firewall perhaps, blocking your request ..

Actually Its a 504 Gateway Timeout I guess...

Connection timeouts occur when:

� The IP address for the requested server is successfully found
� Connection establishment packets are dispatched to the IP address
� The destination address deliberately ignores or does not receive them

Similar to connection timeout is Connection Refused, but in this case the destination system is actually sending packets back saying "go away, there is no service running on the port you are trying to connect to"

Your packets are just being lost.. either the system or some intermediate system is firewalled.. if you can't connect using telnet, a browser or some other app, its a network problem, not java's..


[ December 03, 2008: Message edited by: Mantaker Here ]

[ December 03, 2008: Message edited by: Mantaker Here ]
[ December 03, 2008: Message edited by: �Mantaker� ]

The more the fruits of knowledge become accessible to men, the more widespread is the decline of god's and religious belief...<br /> <br />- Mantaker ..
lakshman kumar
Greenhorn

Joined: Dec 03, 2008
Posts: 3
hi Mantaker,
Thanks for your reply, i came to know that the problem is from the server side, can you please tell me the way to configure the server.because in the server side i am using the IIS6.0, then i am unable to get the response.if the server is tomcat then i am not facing any problem.I can able to get the response.
I tried to include the mime type and also, but the use was nill.Please reply me as soon as possible.
once again thanks for your quick reply
lakshman
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

"�Mantaker�" please check your private messages for an important administrative matter. You can see them by clicking the My Private Messages link above.
Rajaraja Chozhan
Greenhorn

Joined: Dec 03, 2008
Posts: 4
Due to moderator's request I changed my name .. Well, I'm Mantaker here ..

Let me know what you wanna do? Actually, If it is http request alone, You can use tomcat itself .. But comparing IIS with tomcat is unfair .. You can Interface Tomcat with IIS (Bridge) .. For that, You'll find umpteen number of resources on the web .. I personally suggest you to use the tomcat..

But, Need some more clarity about the problem!!

Thank you ..
[ December 04, 2008: Message edited by: Raja Raja Chozhan M A ]
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

"Raja Raja Chozhan M A " thank you for the update but if you look at the Naming policy, then it says that
You can even use an initial or initials for the first name if you like (but not the last).

So you need another update
[ December 04, 2008: Message edited by: Amit Ghorpade ]
lakshman kumar
Greenhorn

Joined: Dec 03, 2008
Posts: 3
hi raja,
The problem is the server is already established one.I am working on the Mobile version of the application.So i can't change the server which is running already.
The server application is .net application.I checked both phone log files and iis log files, in the IIS log files.
In the phone log file it is giving the exception as
java.net.socketException: connection refused
in the iis log file, some bytes were missing from delivering.So i am really confused at this point of time, on the way i have to proceed.Can you please guide me , thanks for your help in advance
lakshman
Rajaraja Chozhan
Greenhorn

Joined: Dec 03, 2008
Posts: 4
Dear moderator .. Is it ok now?? Well lakshman, I'll get back to you, running out of a small work..
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

Yes until someone else thinks that Rajaraja is fake
In my opinion Raja Chozhan will not lead to any problems
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16014
    
  20

Originally posted by Amit Ghorpade:
Yes until someone else thinks that Rajaraja is fake


We're not out to give anyone a hard time here. We're just trying to be professional (even if our mascot is a moth-eaten hunting trophy!).

A "real-looking" name is all we ask. Providing it's truly real and not the name of a celebrity, fictitious character, deity, or other blatant poke in the eye at our dignity. And even those are OK if you can convince us it's not a pseudonym. After all, sometimes people really do have names like that!

One reason we have the naming policy is that first and foremost the JavaRanch is supposed to be a place where you can ask really stupid questions (in some people's opinion, anyway) and still get a respectful answer. "Handles" or pseudonyms provide cover for flamers, so by rejecting such things, we encourage civil discussion. And civil discussion is altogether too rare these days no matter where you go.

Anyway, to address the actual question: A connection timeout can occur for a number of reasons. If the network interface is down, if DNS is required, but the name cannot be resolved, if a data transmission is in progress and stalls due to lack of response from the other end or noise on the channel (more common on mobile devices than on hardwired networks).

Usually you can track this back to a root cause. It's always a good idea to check the stack trace for a "caused by" exception.


Customer surveys are for companies who didn't pay proper attention to begin with.
Rajaraja Chozhan
Greenhorn

Joined: Dec 03, 2008
Posts: 4
Hey guys .. Rajaraja chozhan is my real name .. Well, lakshman can you please answer the following things?

� What IDE are you using?
� If you need to connect the client (Mobile) to an IIS server, then why did you connect it to tomcat? There is no need of doing it even for testing purposes I guess..
� Well, can you post the piece of code which made the exception arise?

thanks
[ December 06, 2008: Message edited by: Rajaraja Chozhan ]
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

Hey guys .. Rajaraja chozhan is my real name ..

Glad to know
Faiza Zafar-Akbas
Greenhorn

Joined: Nov 19, 2010
Posts: 1
Hi all,

did you find a soultion for this problem, since I am facing a similar one :-)
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16014
    
  20

Welcome to the JavaRanch, Faiza!

You've awakend a "zombie" thread. All these people have probably been laid off and moved on to other companies by now. You really should have started your own thread instead.

However, the number one reason for a "Connection timed out" error is lack of ability to connect. Whether it's desktop web browser or mobile device web service, the problem is the same. Usually, either access is blocked (because of a firewall) or there's no network path. In cases of mobile devices, this is often because the device doesn't have a telephone-service provided internet connection.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java.net.ConnectException: Connection timed out