Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How Can interrupt a HTTP connection ?

 
Ould Nadif
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

So far, I can't interrupt my HTTP connection started from my J2ME application. I have to wait until the connection will have etablished to quit the current process. If my connection lasted 20 seconds I would have to wait 20 seconds.

Could you help me to resolve this problem.

OULD NADIF
 
Ould Nadif
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

There is new.

I created two threads: one to connect to my server and another to close the connection.

Thread1{
conn = httpconnection.open(myURL)
}

If I decided to interrupt ma connection I would lauch the second thread without to wait the result of the connection;
Thread2{
conn = httpconnection.close()
}

Like that I caugth the InterruptedIOException and the probem will be resolved.

I tested with the motorola V525, Siemens SX1 and N-gage:
Results:
It works very gooD with motorola. Et in the other cases it failed.

I don't know why.

OULD NADIF
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic