814 Star 4.3K Fork 1.1K

GVPsmartboot / smart-socket

 / 详情

client.start("attachment", new CompletionHandler<AioSession, String>() {

待办的
创建于  
2024-03-15 15:44

这个具体用法可以讲下吗

评论 (28)

刘... 创建了任务

这个用法看不懂,哪来的。

这个是不是在创建的时候会优先于其他的write操作,而优先write

可以等效于发送一段初始化数据

还有个问题就是我client start连接server的时候为神魔会有两个sessionId

应该只有一次啊,我只连接了一次

可以通过debug分析一下

client.start("attachment", new CompletionHandler<AioSession, String>() {
@加贝
public void completed(AioSession result, String attachment) {
aioSession[1] = result;
String att = "attachementaaaaaaaaaaaaaaaaaaaa";
byte[] bytes = att.getBytes(Charset.defaultCharset());
try {
result.writeBuffer().writeInt(bytes.length);
result.writeBuffer().write(bytes);
result.writeBuffer().flush();
System.out.println("success");
try {
writeSession(result, "completed");
} catch (IOException e) {
throw new RuntimeException(e);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}

        @Override
        public void failed(Throwable exc, String attachment) {
            System.out.println("fail");
            exc.printStackTrace();
        }
    });这个是会新增一个session吗

异步方式启动的具体流程讲下呢

两个session一直都是可用的吗

AioQuickClient client = new AioQuickClient("127.0.0.1", 8081, new StringProtocol(), processor2);
client.start("attachment", new CompletionHandler<AioSession, String>() {
@加贝
public void completed(AioSession result, String attachment) {}
})

没有client.start("attachment", new CompletionHandler<AioSession, String>())这个接口吧

还有个问题就是比如我先write and flush的消息,一定会在接收端先到达嘛

而且我看同一个会话server端和客户端不是一个sessionid,这是为什么

你看下sessionId的生成算法就知道了

@三刀 还有个问题就是比如我先write and flush的消息,一定会在接收端先到达嘛

没懂什么意思

@刘... 比如我加锁了一个session对象,然后write and flush了,之后又write and flush另外一块消息,那么这两块消息在tcp长链接里面有顺序吗

@刘... 对端接收到的时候会有顺序吗?还是说因为网络传输的不确定性会导致这两个消息接受的不确定性,

按write的顺序接收

想问下我们这个组件的技术栈,是传输层协议还是应用层协议,底层技术栈是epoll 还有神魔嘛

应用层。

想问下session是客户端先创建然后服务端再创建是吗

想问下同一台机器上docker部署两个项目,从session里面获取的是容器内部ip还是公网ip,我这边获取的是容器内部ip,但是隔着机器就没事,想问下如何避免

但是我看获取的ip与docker inspect的结果也不一样啊

从session获取的是容器的网关ip

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
351975 smartdms 1578921064
Java
1
https://gitee.com/smartboot/smart-socket.git
git@gitee.com:smartboot/smart-socket.git
smartboot
smart-socket
smart-socket

搜索帮助