nvm use v16.19.1
npm run dev
npm run build
smartboot / smart-socket Goto Github PK
View Code? Open in Web Editor NEWA High Performance Java AIO framework
Home Page: https://smartboot.gitee.io/
License: Apache License 2.0
A High Performance Java AIO framework
Home Page: https://smartboot.gitee.io/
License: Apache License 2.0
nvm use v16.19.1
npm run dev
npm run build
自定义tcp协议链接同一个server,同样的代码,多次测试后发现,centos平台下载速度是windows平台的100多倍。
环境:
windows server2012.
centos7.
jdk21
在SpringBoot启动的时候注册若干个client,但是client发起连接之后没有找到注册监听连接状态的监听器,netty中有bootstrap.connect().addListener()的方法,请问smartSocket如何实现?
android新手提问,怎么在android studio里面安装?
README.md中的“文档地址”链接失效了,在哪可以看到最新的文档呢?
我看代码和 example 都是 tcp、udp 这种 ip 层以上的协议。
我需要跟硬件通信:串口在系统层面是个文件描述符 FileDescriptor
,通过往这个特殊的文件读写数据来跟硬件通信。
数据是“指令+分隔符+内容”这种格式。我的业务处理是:接到硬件传来的数据后,通过互联网与用户交互。收到用户的反馈请求后再往硬件写入。
如果您在您的个人或公司项目中使用了smart-socket,欢迎在此留言。
推荐回复格式:
- 项目:
- 公司:(如果可以)
- 描述:
We appreciate you support if you or your organization is using Smart-Socket. You are welcome to leave replies about your product and organization here, which could became the confidence of maintiners, communication and undecided watchers.
Recommended reply format:
- Product:
- Company or Organization: (if any)
- remark:
你这个相当于原来nio的aio实现版本吧,server底层使用的还是nio的api
如何设置连接超时时间和连接超时回调代码。
在client设置。
AioQuickClient client = new AioQuickClient(config.getStorageIp(), config.getStorageTcpPort(), new ImgByteProtocol(list), processor);
client.connectTimeout(3 * 1000);//连接超时时间
但是有没有设置连接超时的回调接口?
<dependency>
<groupId>org.smartboot.socket</groupId>
<artifactId>aio-pro</artifactId>
<version>1.6.6</version>
</dependency>
用的springboot3.2.1.smar-socket client并发的时候经常连接超时,不确定是不是服务器的问题还是smartsocket的问题。smart-socket的线程支持指定虚拟线程吗,或者指定线程池?
大佬你好,我目前在使用SmartSocket提供的AioQuckClient连接局域网内的设备收取其TCP报文,以达到监控的目的。目前出现的问题是
收到的所有的TCP报文均有一分钟左右的延迟滞后,我不是很明白是否是配置出现问题,我使用的项目版本是1.5.30
以下是我的核心连接逻辑
for (EBasicInfo elevator : list) {
if (elevatorSessionMap.get(elevator.getId())!=null)continue;
AioQuickClient client = new AioQuickClient(elevator.getIpAddress(), elevator.getCanPort(), new ElevatorProtocol(), elevatorProcessor);
client.setReadBufferSize(1000);
try {
AioSession session = client.start();
session.setAttachment(elevator.getId());
elevatorSessionMap.put(elevator.getId(),session);
}
catch (IOException e) {
log.error("elevator 连接失败 elevatorId={}",elevator.getId());
}
}
以下我的协议中的decode函数,作用是把TCP报文拆分成一个个CAN数据包
List<byte[]> canFrameList=new ArrayList<>();
while ((readBuffer.remaining() >= CAN_LENGTH)) {
readBuffer.mark();
byte b1 = readBuffer.get();
byte b2 = readBuffer.get();
if (b1 == CAN_HEADER[0] && b2 == CAN_HEADER[1]) {
readBuffer.reset();
byte[] canFrame = new byte[CAN_LENGTH];
readBuffer.get(canFrame);
if (canValidate(canFrame)) {
byte[] canId= Arrays.copyOfRange(canFrame,4,8);
if ((Ints.fromByteArray(canId)==0x7d0)) {
if (Byte.toUnsignedInt(canFrame[8])==0xa0&&Byte.toUnsignedInt(canFrame[9])==0xa1) {
log.debug("canFrame:{}",Arrays.toString(ByteUtils.byteArrayTo0xStringArray(canFrame)));
}
}
canFrameList.add(canFrame);
}else {
log.debug("校验不通过");
}
}else {
log.debug("不满足can header");
readBuffer.reset();
readBuffer.get();
}
}
return canFrameList;
我尝试像代码中一样打印出所有的can 帧,所有的包都落后于工具抓包一分钟左右,请问我可以如何排查问题呢?
E:**\src\main\java\module-info.java:1: 错误: 模块 com...system 同时从 aio.core 和 aio.pro 读取程序包 org.smartboot.socket.transport
已经添加了打印了插件 :
processor.addPlugin(new StreamMonitorPlugin<>());//打印日志
怎样由springboot的logbak来打印收发数据的日志?
不确定是哪里多线程同时操作了?
是不是需要selectionKey.isValid() 先判断一下?
java.nio.channels.CancelledKeyException
at sun.nio.ch.SelectionKeyImpl.ensureValid(SelectionKeyImpl.java:73)
at sun.nio.ch.SelectionKeyImpl.interestOps(SelectionKeyImpl.java:77)
at org.smartboot.socket.enhance.EnhanceAsynchronousChannelGroup.removeOps(EnhanceAsynchronousChannelGroup.java:122)
at org.smartboot.socket.enhance.EnhanceAsynchronousServerChannel.doRead(EnhanceAsynchronousServerChannel.java:273)
at org.smartboot.socket.enhance.EnhanceAsynchronousChannelGroup.lambda$new$0(EnhanceAsynchronousChannelGroup.java:76)
at org.smartboot.socket.enhance.EnhanceAsynchronousChannelGroup$Worker.run(EnhanceAsynchronousChannelGroup.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
支持smart-socket的发展,如果有更多的例子,大家使用起来会更加方便。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.