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
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

PHP File Upload Problem
Hi, I have written a very simple file upload script but it fails for reasons I can't explain. Hope

PHP Blog help
Need help with posting comments in a word press blog? I have a comments page where the comments are

explode() function problem maybe
Hi I'm having trouble searching my database. When I type two words in the search field it only searc

Which practice of iteration through containers is preferred
In the "real world" what kind of loop do most people use to iterate through a container like a vecto

ALV grid with 2 headers
Hi Gurus,

I need to display ALV GRID as below.

Header1

get font info from a font file
hello,

Does anyone know how to get font info from a font file ... using php of course !
<

CU&UC guide
Hi Gurus,

can anybody provide me the link for CU&UC upgrade guide

Thanks i

Accessing element of object array
Hello

My object looks like this:


Array ( [0] => User Object ( [id] =>

Generating unique numbers using php
Hi,
I need help in generating unique number using php.I tired using rand() in php.But, by using r

IIS & NW MII on the same server
Hi,

We're weighing the possibility to run both IIS and MII (NetWeaver) on the same server

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