Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement TCPServerCommProvider 2 #245

Closed
wants to merge 1 commit into from

Conversation

MichaelElmore1
Copy link

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 #241 but with TCPCommProvider unmodified. I wanted to make it the same PR, but I made a mess of things. Sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant