-
Notifications
You must be signed in to change notification settings - Fork 15
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
Example-Code? #3
Comments
Hi, there's a very basic example in the README: The rule of thumb is to do exactly the same things you would do when using How to add the library to your classpath depends on what build system you're using so I can't give a general example here. |
So far the client and server to communicate in localhost on one device. I'm trying to get multiple devices to communicate with each other. Unfortunately, I cannot deduce how multiple devices should communicate. Do I have to use RUDP in addition to UDP or can RUDP alone communicate via broadcast? Sorry for the many questions. I'm still in training. |
Imagine the RUDP library as if using TCP. That means that just like in TCP we're connection-orientated and have a server/client model. In (simple) TCP setups, you usually have a single TCP server on some machine and an arbitrary amount of TCP clients on other machines, all connected to the single server. When using RUDP, just follow along any tutorial written for java.io sockets - setup a server socket, connect one or more client socket to that server i.e using this constructor RUDP/RUDP/src/net/rudp/ReliableSocket.java Line 114 in 1053c3e
and then exchange data using the Sockets InputStreams/OutputStreams. Any good Java socket tutorial should cover this. If you're looking for non-TCP models such as mesh networks (i.e. all clients are connected with each other), I'm not sure if this library is the right fit for that. You can probably implement such a system with RUDP, but you will need to handle most of the logic required for that yourself (each client will likely need a server socket and establish outgoing connections to the other clients. You might also need discovery mechanisms etc). RUDP is essentially assigned as a drop-in replacement for TCP, if TCP is too heavy or can't be used for some reason. |
public class Client { ReliableSocket rs; public Client() throws IOException {
} public Server() throws Exception {
} example-code like this? |
Hello,
do you have an example-code or tutorial how I can use RUDP in Java?
best regards
The text was updated successfully, but these errors were encountered: