Re: singe thread per connection
- From: Corneil <corneil.duplessis@xxxxxxxxx>
- Date: Sun, 13 Jul 2008 10:06:31 -0700 (PDT)
On Jul 11, 9:32 pm, Praki <visitprakashin...@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. is there
any way in which i can create telnet connection with single thread for
single connection. When i say
InputStream is =new BufferedInputStream(process.getInputStream());
InputStreamReader read=new InputStreamReader(is);
BufferedReader input = new BufferedReader(read);
try {
int c;
while (0 != (c = is.read())) {
shellIo.write((char)c);}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();}
the read gets blocked here. and also if say in the read from the
client it goes blocked, so is there any way that i can do it using
single thread
thanks in advance
k.p
You should look at articles on non-blocking sockets.
i.e: http://www.onjava.com/pub/a/onjava/2002/09/04/nio.html
.
- References:
- singe thread per connection
- From: Praki
- singe thread per connection
- Prev by Date: Re: ***!
- Next by Date: Re: Any Class Viewer users?
- Previous by thread: Re: singe thread per connection
- Next by thread: Getting the lastday of previous month
- Index(es):