Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tambapps/speer
A library to perform P2P connection and exchange data between peers
https://github.com/tambapps/speer
datagram java p2p peer-to-peer socket speer tcp udp
Last synced: 14 days ago
JSON representation
A library to perform P2P connection and exchange data between peers
- Host: GitHub
- URL: https://github.com/tambapps/speer
- Owner: tambapps
- License: apache-2.0
- Created: 2021-05-03T17:47:47.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-07T15:52:19.000Z (about 2 years ago)
- Last Synced: 2024-11-13T08:36:27.802Z (2 months ago)
- Topics: datagram, java, p2p, peer-to-peer, socket, speer, tcp, udp
- Language: Java
- Homepage:
- Size: 225 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Speer - a P2P communication library
Speer is a library used to perform P2P communication easier. It uses the plain Java
Socket API to allow communicating between two devices.You can consult the [wiki](https://github.com/tambapps/speer/wiki) for a detailed documentation
## Use cases
Take a look at [Fandem](https://github.com/tambapps/P2P-File-Sharing) a P2P file sharing app.
This project uses speer to send/receive files between devices in P2P, and also to discover Fandem peers with UDP.## Examples
Server-side
```groovy
import com.tambapps.p2p.speer.PeerServertry (PeerServer server = peerServer();
PeerConnection connection = server.accept()) {
connection.writeUTF("Hello! do you want to talk to me?");
if ("yes".equals(connection.readUTF())) {
talk(connection);
}
}
```Client-side
```groovy
try (PeerConnection connection = PeerConnection.from(peer)) {
connection.readUTF()
connection.writeUTF("yes")
talk(connection)
}
```## Import with maven
This library is [hosted on Jitpack](https://jitpack.io/#tambapps/speer/v1.0)You can import it to your project by adding the Jitpack repository
```xml
jitpack.io
https://jitpack.io
```And then add the dependency
```xml
com.github.tambapps
speer
1.0
```