[Telnetd-devel] Problem using Telnet daemon
Brought to you by:
wimpi
From: Singhal, A. (Ankit) <asi...@lu...> - 2004-06-19 04:52:44
|
Hi Dieter I am a new user of your TelnetD software.I want to embed this to my software, but I am facing some problems in regard to that. The problem is being faced while implementing the Shell Class. I want to implement my own shell class (MyShell.java).In this shell class I am connecting to some other Software component. So while implementing that class I have to use available() as a call instead of read() because i don'nt want to block my program on that. The problem i am facing is that when the user closes the Telnet client abrubtly , my Telnet Daemon program doesn't end the conectio thread while if i am using your DummyShell then this is taken care by you. I further investigated the code , and i found that you have use EOF Exception to check this condition. So I put my available() code in try block and used the same EOF Exception condition to catch it. But it is not coming in catch block when I forcefully close the telnet client . Can you please let me know at waht pint am doing the error. Please find below the snippet of code what i am writing. try{ while(iss.available()>0) { System.out.println("Inside avilable"); i=iss.read(); if (i == -1 || i == -2) { TelnetD.debuglog.write("Input(Code):" + i); flag=false; break; } if(channel.isEOF()) { flag=false; System.out.println("Disconnected"); break; } fout.write(i); //Key Stroke Logging } }catch(EOFException) { if (m_Connection.isActive()) { System.out.println("Connection broken forcefully"); TelnetD.debuglog.write("Registering broken connection " + m_Connection.toString() + " active=" + m_Connection.isActive()); m_ConnectionData.getManager().registerBrokenConnection(m_Connection); } Thanks and Regards Ankit |