Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Mutiple Http Request

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am using http handler to handle http request. but i am getting problem when i am sending multiple request from different client then request are process in sequence. and there is delay in request processing. can any body please help me that how can i process multiple http request parallel.

 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code seems to handle only a single response. How are you using it that you think it should handle multiple simultaneous requests?
 
Aiyush Kumar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so please tell me what will i use to handle multiple request simultanious.
 
Ulf Dittmer
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We can't know that - what kind of software is this: part of a web app? A desktop app? A standalone server? Something else?

If you're trying to design a multi-threaded Java server, start here: http://download.oracle.com/javase/tutorial/networking/sockets/index.html
 
Aiyush Kumar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually i m trying to make a standalone server. which handle the http request from multiple client at same time. and i am using http handler to handle the request. but it is processing only one request at a time, and i want to access multiple http request at same time. the link provide by you is only for simple socket programming where a client sends request to server. please help me out that how i can i access multiple requests at same time.
 
Ulf Dittmer
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you worked through the tutorial I pointed you to? It contains an example of a multi-threaded server.
 
Aiyush Kumar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Ulf. but go through your suggested link but that explain only single thread application not for multi-threaded. please can you give me some example to my problem. because i am handling request generated on an particular ip and port.
 
Ulf Dittmer
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apparently you missed the part where the multi-threaded server is discussed; it's in the "Supporting Multiple Clients" section.
 
Sheriff
Posts: 21999
107
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For multi-threaded responses, you'll need multiple connections (sockets) and one thread per connection. This thread will execute the handle method. This is explained at the bottom of the page Ulf linked to.
 
Aiyush Kumar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf, actually i want to handle the http request by getRequestHeader or requestBody methods. otherwise i have to split the data from URl. and with serversocket i can't access HttpExchange which directly get the header and body part of data from request. and with httpExchange i can't access multi-threading. can you please help me by providing any other solution.
 
Listen. That's my theme music. That's how I know I'm a super hero. That, and this tiny ad told me:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic