[xSocket-develop] A clerical error in the XScoket core tutorial
Status: Inactive
Brought to you by:
grro
|
From: <yud...@ns...> - 2008-03-04 02:31:25
|
Hi:
I am a new user of XSocket, when I study the core
tutorial on
http://xsocket.sourceforge.net/core/tutorial/V2/TutorialCore.htm, in the
section "7. Handling timeout's", the sample code is :
// the handler
class Handler implements IDataHandler, IIdleTimeoutHandler,
IConnectionTimeoutHandler {
public boolean onConnectionTimeout(INonBlockingConnection nbc)
throws IOException {
nbc.write("bye bye");
nbc.close();
return true; // prevent, that xSocket also closes the
connection
}
public boolean onConnectionTimeout(INonBlockingConnection nbc)
throws IOException {
nbc.write("What's going on? Why don't you send data?");
connection.setIdleTimeoutSec(30); // resets the timeout counter
return true; // prevent, that xSocket closes the connection
}
public boolean onData(INonBlockingConnection nbc) throws IOException
{
...
return true;
}
}
// and the server
IServer server = new Server(8090, new Handler());
server.setIdleTimeoutSec(30); // set the default idle timeout for
server-side connections
server.run();
These 2 function are same, but I think the second should be " public
boolean onIdleTimeout(INonBlockingConnection arg0)", is it right?
Thanks.
Best regards
=======================
Wang Yudong
15882146156
|