Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple Connections to a Server

 
Submit Plastic
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have recently expanded my JAVA'ing from doing basic applets for my sites and such, into doing a lot of web based applications. I have been trying to figure out how to get multiple people to connect to a java server at once. I tried using threads, and thought I was on the right track, but i keep hitting dead ends. Any help would be great.


Submit.

submitplastic@gmail.com
 
Warren Dew
blacksmith
Ranch Hand
Posts: 1332
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what you mean by a "Java server", but if they are web based applications, shouldn't a web server like Apache, with a Java/JSP application server like Tomcat, do the job?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're writing your own server - a fun and educational experience - you'll have a ServerSocket somewhere that does accept(). This gives you a socket that is connected to the client. If you put all processing of the socket on another thread, the main thread can be ready to accept another connection in no time at all. Here are few lines from my Wiki server ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic