名字
本例子演示的是一个典型的TCP长连接应用,大体业务简介如下。
16:29:38,233 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@2133c8f8 - Registering current configuration as safe fallback point
2019-06-29 16:29:38 ERROR org.tio.client.TioClient[349]: closeds:0, connections:0
2019-06-29 16:29:38 INFO org.tio.client.TioClient[310]: [1]: curr:0, closed:0, received:(0p)(0b), handled:0, sent:(0p)(0b)
2019-06-29 16:29:38 INFO o.t.c.ConnectionCompletionHandler[102]: connected to 127.0.0.1:6789
收到消息:收到了你的消息,你的消息是:hello world
2019-06-29 16:29:39 INFO org.tio.client.TioClient[310]: [1]: curr:1, closed:0, received:(1p)(55b), handled:1, sent:(1p)(15b)
2019-06-29 16:29:40 INFO org.tio.client.TioClient[310]: [1]: curr:1, closed:0, received:(1p)(55b), handled:1, sent:(1p)(15b)
服务器端界面
2019-06-29 16:29:30,753 INFO org.tio.server.TioServer[158]:
|----------------------------------------------------------------------------------------|
| Tio on github | https://github.com/tywo45/t-io |
| Tio site address | https://www.tiocloud.com/ |
| Tio version | 3.3.3.v20190620-RELEASE |
| ---------------------------------------------------------------------------------------|
| TioConfig name | hello-tio-server |
| Started at | 2019-06-29 16:29:30 |
| Listen on | 0.0.0.0:6789 |
| Main Class | org.tio.study.helloworld.server.HelloServerStarter |
| Jvm start time | 383 ms |
| Tio start time | 16 ms |
| Pid | 4632 |
|----------------------------------------------------------------------------------------|
收到消息:hello world
客户端界面
16:24:33,525 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
16:24:33,526 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@5ba23b66 - Registering current configuration as safe fallback point
使用指南:
1、需要帮助,输入 '?'.
2、登录,输入 'login loginname password'.
3、进入群组,输入 'join group1'.
4、群聊,输入 'groupMsg group1 text'.
5、点对点聊天,输入 'p2pMsg loginname text'.
6、退出程序,输入 'exit'.
login tan 111
收到登录响应消息:{"code":1,"time":1561796684113,"token":"1561796684113_1"}
登录成功,token是:1561796684113_1
服务器端界面
2019-06-29 16:24:29,011 INFO org.tio.server.TioServer[158]:
|----------------------------------------------------------------------------------------|
| Tio on github | https://github.com/tywo45/t-io |
| Tio site address | https://www.tiocloud.com/ |
| Tio version | 3.3.3.v20190620-RELEASE |
| ---------------------------------------------------------------------------------------|
| TioConfig name | null |
| Started at | 2019-06-29 16:24:29 |
| Listen on | 0.0.0.0:5678 |
| Main Class | org.tio.study.showcase.server.ShowcaseServerStarter |
| Jvm start time | 523 ms |
| Tio start time | 17 ms |
| Pid | 21016 |
|----------------------------------------------------------------------------------------|
2019-06-29 16:24:33,766 INFO o.t.e.s.s.ShowcaseServerAioListener[44]: onAfterConnected channelContext: server:0.0.0.0:5678, client:127.0.0.1:58326, isConnected:true, isReconnect:false
2019-06-29 16:24:44,112 INFO o.t.e.s.s.h.LoginReqHandler[61]: 收到登录请求消息:{"loginname":"tan","password":"111","time":1561796683947}
2019-06-29 16:24:44,125 INFO o.t.e.s.s.ShowcaseServerAioListener[61]: onAfterSent channelContext: server:0.0.0.0:5678, client:127.0.0.1:58326, packet:{"blockSend":false,"body":"eyJjb2RlIjoxLCJ0aW1lIjoxNTYxNzk2Njg0MTEzLCJ0b2tlbiI6IjE1NjE3OTY2ODQxMTNfMSJ9","byteCount":0,"fromCluster":false,"id":2,"sslEncrypted":false,"synSeq":0,"type":2}, isSentSuccess:true
最新评论 我的评论
t-io为本站提供HTTP、WebSocket、Socket、页面渲染与压缩等服务,nginx为本站提供反向代理服务
© 2017-2023 钛特云 版权所有 | 浙ICP备17032976号 | 浙公网安备 33011802002129号