云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > SuperSocket学习进展

SuperSocket学习进展

  • 62 次阅读
  • 3 次下载
  • 2025/6/24 9:06:47

{

var session = commandContext.Session;

var startTime = session.Items.GetValue(\ var ts = DateTime.Now.Subtract(startTime);

if (ts.TotalSeconds > 5 && session.Logger.IsInfoEnabled) {

session.Logger.InfoFormat(\commandContext.CurrentCommand.Name, ts.ToString()); } } }

然后通过增加属性的方法给命令 \应用此过滤器: [LogTimeCommandFilter]

public class QUERY : StringCommandBase {

public override void ExecuteCommand(TestSession session, StringCommandInfo commandData) {

//Your code } }

如果你想应用次过滤器给所有的命令, 你可以向下面的代码这样将此命令过滤器的属性加到你的 AppServer 类上面去: [LogTimeCommandFilter]

public class TestServer : AppServer { }

你可以通过将 commandContext's 的 Cancel 属性设为 True 来取消当前命令的执行: public class LoggedInValidationFilter : CommandFilterAttribute {

public override void OnCommandExecuting(CommandExecutingContext commandContext) {

var session = commandContext.Session as MyAppSession;

//If the session is not logged in, cancel the executing of the command if (!session.IsLoggedIn)

commandContext.Cancel = true; }

public override void OnCommandExecuted(CommandExecutingContext commandContext) { } }

ServerConfig配置内没有对ipRange的配置,只有ConnectionFilter属性,但完全不起作用,难道只能使用BootstrapFactory启动才能使用连接过滤吗?

多个 Listener(监听器)

关键字: 多个端口, 多个监听, Listener, 多个Listener

单个 listener

在下面的配置中,你可以配置服务器的监听 ip/port:

serverType=\SuperSocket.QuickStart.TelnetServer_StartByConfig\ ip=\

多个 listener

你可以增加一个子节点 \用于添加多对监听 ip/port:

type=\SuperSocket.QuickStart.EchoService\

在这种情况下,服务器实例将监听两个本地端口。 这个功能和 IIS 站点的多绑定功能非常相似。 你也可以给不同的监听器设置不同的选项:

type=\SuperSocket.QuickStart.EchoService\

搜索更多关于: SuperSocket学习进展 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

{ var session = commandContext.Session; var startTime = session.Items.GetValue(\ var ts = DateTime.Now.Subtract(startTime); if (ts.TotalSeconds > 5 && session.Logger.IsInfoEnabled) { session.Logger.InfoFormat(\commandContext.CurrentCommand.Name, ts.ToString()); } } } 然后通过增加属性的方法给命令 \

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com