Coder Social home page Coder Social logo

smartboot / smart-socket Goto Github PK

View Code? Open in Web Editor NEW
504.0 36.0 111.0 8.17 MB

A High Performance Java AIO framework

Home Page: https://smartboot.gitee.io/

License: Apache License 2.0

Java 99.88% Dockerfile 0.10% Makefile 0.02%
aio java socket iot rpc nio2

smart-socket's Issues

疑问

你这个相当于原来nio的aio实现版本吧,server底层使用的还是nio的api

怎么在logbak中打印日志

已经添加了打印了插件 :

processor.addPlugin(new StreamMonitorPlugin<>());//打印日志

怎样由springboot的logbak来打印收发数据的日志?

java 模块化 module-info.java

E:**\src\main\java\module-info.java:1: 错误: 模块 com...system 同时从 aio.core 和 aio.pro 读取程序包 org.smartboot.socket.transport

AioClient收到的TCP报文延迟高

大佬你好,我目前在使用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 帧,所有的包都落后于工具抓包一分钟左右,请问我可以如何排查问题呢?

串口通信能用这个库实现吗?

我看代码和 example 都是 tcp、udp 这种 ip 层以上的协议。

我需要跟硬件通信:串口在系统层面是个文件描述符 FileDescriptor,通过往这个特殊的文件读写数据来跟硬件通信。
数据是“指令+分隔符+内容”这种格式。我的业务处理是:接到硬件传来的数据后,通过互联网与用户交互。收到用户的反馈请求后再往硬件写入。

怎么安装?

android新手提问,怎么在android studio里面安装?

是否支持虚拟线程?

    <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的线程支持指定虚拟线程吗,或者指定线程池?

smart-socket Users

如果您在您的个人或公司项目中使用了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: 

AioQuickClient如何监听连接状态?

在SpringBoot启动的时候注册若干个client,但是client发起连接之后没有找到注册监听连接状态的监听器,netty中有bootstrap.connect().addListener()的方法,请问smartSocket如何实现?

客户端连接超时时间和超时回调接口在哪设置?

如何设置连接超时时间和连接超时回调代码。
在client设置。
AioQuickClient client = new AioQuickClient(config.getStorageIp(), config.getStorageTcpPort(), new ImgByteProtocol(list), processor);
client.connectTimeout(3 * 1000);//连接超时时间
但是有没有设置连接超时的回调接口?

aio-core 1.5.31 版本会提示这个错

不确定是哪里多线程同时操作了?

是不是需要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)

文档地址失效了

README.md中的“文档地址”链接失效了,在哪可以看到最新的文档呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.