I added a TCPServerCommProvider, which allows OSH to act as a server and send or receive data from a number of clients.
Since there are multiple input and output streams, one per client, I added onConnection, where you can register a listener for connections. To use it, register some code to be run when a client connects, like this:
commProvider.onConnection(args -> {
//do stuff with args.getInputStream() and getOutputStream()
})
or (alt syntax)
commProvider.onConnection(this::handleConnection)
...
handleConnection(ConnectionEventArgs args) {
//do stuff with args.getInputStream() and getOutputStream()
}
Note that this is a duplicate of https://github.com/opensensorhub/osh-core/pull/241 but with TCPCommProvider unmodified. I wanted to make it the same PR, but I made a mess of things. Sorry about that.
I added a TCPServerCommProvider, which allows OSH to act as a server and send or receive data from a number of clients.
Since there are multiple input and output streams, one per client, I added onConnection, where you can register a listener for connections. To use it, register some code to be run when a client connects, like this:
or (alt syntax)
Note that this is a duplicate of https://github.com/opensensorhub/osh-core/pull/241 but with TCPCommProvider unmodified. I wanted to make it the same PR, but I made a mess of things. Sorry about that.