订阅事件:
appServer.NewSessionConnected += new SessionHandler<AppSession>(appServer_NewSessionConnected);
appServer.SessionClosed += new SessionHandler<AppSession, CloseReason>(appServer_SessionClosed);
定义事件处理方法:
static void appServer_SessionClosed(AppSession session, CloseReason reason)
{
Console.WriteLine("A session is closed for {0}.", reason);
}
static void appServer_NewSessionConnected(AppSession session)
{
session.Send("Welcome to SuperSocket Telnet Server");
}