How to implement HTTP connection timeout


Posted on 16th Feb 2014 07:03 pm by admin

Hi All,I would like to implement an HTTP connection timeout.

I am working on a application which uses HTTP connection,
but the problem here is that the response from server
Did you know?Explore Trending and Topic pages for more stories like this.
is late... I want to create a timeout against HTTP
request such that if response doesn't come within sec
then the connection should get closed.

Please let me know how I can implement this.

Code is like:

HttpConnection connection = null;
connection = (HttpConnection) Connector.open(getURL(), Connector.READ);
int responseCode = connection.getResponseCode();

I am receiving response code almost after 2-3 sec.. and
sometimes 1-2 mins too, which makes my application hang.

I want to create a timeout for such situation, Please let
me know how I can implement.. "connection" variable is
a local variable.

Thanks
No comments posted yet

Your Answer:

Login to answer
93 Like 35 Dislike
Previous forums Next forums
Other forums

Populate drop down list from table??
Lets say for arguments sake that i have a table which contains the numbers 1 to 10.
How can i get

Multiple Do / While Statements?
I'm still very new to PHP, and running in to a problem when trying to execute a do/while loop inside

Parse error: parse error in C:wampwwwlogspagesmembers.php on line 16
I dont see the problem with this, I always get Parse error: parse error in C:wampwwwlogspagesme

php libs/ browsercap.in
ok i have a host that refuses to stay current. they control my php settings and libs. is there a way

Impact of movement type 412 E on MAP
Hi

Usage of movement type 412 E is causing huge change in MAP .

Is there any r

need help in php variable
i have a php variable on one page
Code: [Select]$lastId = mysql_insert_id($db);
echo $lastId;<

Printer configuration
Hi All,
Suppose one of the user deleted the printer settings unfortunatly ,then what is the pro

php file erros / need help please
Hello

Someone decoded a zend file for me.. after uploaded it on ftp i get some errors, i trye

EXplanation help
Hey all,

I am still fairly new to PHP programming and I am trying to put together a page wher

PHP FTP Can't upload Big FIles
Anyone had any success using FTP to upload a file say 90m?

im using ftp_put and it returns fa

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash