0

I want to create a simple http asyn client interface that sends the get request and recieve the response from the server.

Though I want to control the number of request sends per second also the response is a asyn handling.

The key is I want to specify number of request per second so as to load the server.

I have searched that Ning AsyncHttpClient interface but it does allow to set the number of requests per second. So I think to use RAW sockets in Java and create interface like it.

Can you please help me in suggesting what framework provide these functionality or else what API I use to achieve this functionlaity.

Thanks, Manish

  • Just create a simple class that sends and receives a request, then get the time before the request was sent, then again after. Get the difference then wait until that delta time is up and repeat. Pretty simple – ug_ Feb 10 '14 at 09:14
  • I would control the request rate yourself. You can have a loop which sends requests and sleeps until the next request should be sent. – Peter Lawrey Feb 10 '14 at 09:16
  • Why would you want to use raw sockets for http, you'd need to implement TCP yourself – ooxi Feb 10 '14 at 09:37
  • You should not use RAW sockets for this but rather search the java.net package. Especially java.net.URLConnection and java.net.HttpURLConnection. Here is a nice answer that might help. http://stackoverflow.com/questions/2793150/how-to-use-java-net-urlconnection-to-fire-and-handle-http-requests – FuryFart Feb 10 '14 at 09:41

1 Answers1

2

No, Java doesn't support raw sockets, although various third party libraries do. I don't see anything in your question that needs them.

user207421
  • 289,834
  • 37
  • 266
  • 440