calimero-project / calimero-core

Core library for KNX network access and management
Other
129 stars 65 forks source link

发现服务是不是我用的方法不对 #131

Closed bert1020 closed 1 month ago

bert1020 commented 2 months ago

我每次搜索完成之后,我的理解是搜索时创建的socket连接应该关闭的,但事实上却没有关闭.

我的场景是 每10秒重新去发现一次所有服务,以便中途接通的服务也可以被发现

我这样写之后,socket连接一直在增加,,没有关闭

bmalinowsky commented 2 months ago

The implementation currently relies on the Cleaner mechanism, which is probably not optimal. The connections should go away, but will linger for a while.

bert1020 commented 1 month ago

谢谢你的回复, 现在的情况是:如果我不改linux系统连接数的情况下,循环运行一段时间很容易报错. java.net.SocketException:打开的文件过多(Socket creation failed) 我可以显式的关闭它吗?

bmalinowsky commented 1 month ago

Which version are you currently using? Snapshots?

bert1020 commented 1 month ago

`

io.calimero
        <artifactId>calimero-core</artifactId>
        <version>3.0-SNAPSHOT</version>
    </dependency>`

用的是这个版本

bmalinowsky commented 1 month ago

The discoverer in the snapshot build should now close its selector and channel during quit, so successive socket creation should not be an issue anymore. Thanks for noticing!

bert1020 commented 1 month ago

thanks