Re: singe thread per connection
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Fri, 11 Jul 2008 18:10:24 -0700
On Fri, 11 Jul 2008 12:32:19 -0700, Praki <visitprakashindia@xxxxxxxxx> wrote:
I need to implement the telnet using single thread for one telnet
connection. I saw one of the usage of this telnetd with four threads
for single connection. I need to open arround minimum of 500 telnet
connections. so it will not be good to have 500*4 threads.
For that matter, I'm not convinced it would be good to have 500 threads.
is there
any way in which i can create telnet connection with single thread for
single connection.
I'm not really clear on why the example you've see used four threads for one connection. I would think two would be enough even for the most naïve implementation. However, to get your implementation down to one thread per connection, and possibly even fewer (i.e. have a thread that handles multiple connections), you may want to look at SelectableChannel (you can get one from a Socket instance) and the Selector class (which allows you to have a single thread monitor multiple SelectableChannels for read and write readiness).
I'm not familiar enough with Java to know if there's an asynchronous API for the stream classes, but if there is, that would be another option.
Pete
.
- Follow-Ups:
- Re: singe thread per connection
- From: Neil Coffey
- Re: singe thread per connection
- References:
- singe thread per connection
- From: Praki
- singe thread per connection
- Prev by Date: Re: Applet and Javascript
- Next by Date: Re: NetBeans giving error at dataTable tag. Missing JAR?
- Previous by thread: singe thread per connection
- Next by thread: Re: singe thread per connection
- Index(es):
Relevant Pages
|