• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sending a http-request without waiting for response

 
Sasha Ruehmkorf
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I am sending http-requests to a webservice but am not interested in the response.

So I used the URL.openConnection()-Method, opened an OutputStream wrapped by an OutputStreamWriter and sent the request. But even flushing and closing this Writer does not result in the request to be actually processed by the service. I have access to the logfile of this service so I can see that the service receives this request (or starts to log and process it) not until I use the Connection.getInputStream()-method. Of course this results in my program waiting until the service has done a lot of processing and written the response. But this takes quite a long time and I don't need the response. (Creating a new Thread to send the request and wait is unfortunately not an option)

Anyone an idea where exactly the problem lies?
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sasha Ruehmkorf:

Anyone an idea where exactly the problem lies?


You are not using HTTP correctly. HTTP is a request-response protocol. By not reading the response you are not fulfilling the protocol and the server is (correctly) ignoring your request.
 
Sasha Ruehmkorf
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's exactly the answer I feared the most ;-)

Thanks for your quick reply!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!