https://github.com/clickermonkey/falcon
A fast Java event-driven networking library that has a unified API over various networking technologies: TCP, UDP, blocking (OIO), and non-blocking (NIO).
https://github.com/clickermonkey/falcon
Last synced: 10 months ago
JSON representation
A fast Java event-driven networking library that has a unified API over various networking technologies: TCP, UDP, blocking (OIO), and non-blocking (NIO).
- Host: GitHub
- URL: https://github.com/clickermonkey/falcon
- Owner: ClickerMonkey
- License: osl-3.0
- Created: 2013-04-30T18:02:59.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-11-15T20:53:21.000Z (about 12 years ago)
- Last Synced: 2025-04-12T07:08:54.825Z (10 months ago)
- Language: Java
- Homepage:
- Size: 699 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
falcon
======

A fast Java networking library that has a unified API over various networking technologies: TCP, UDP, blocking (OIO), and non-blocking (NIO).
*Disclaimer: this is a work in progress, although should operate fine as is. Plans for refactoring and heavier testing are in the works*
**Features**
- Either OIO (java.io) or NIO (java.nio) can be used. The blocking-nature of the underlying library is hidden.
- Either TCP or UDP can be used, the underlying transport protocol is hidden.
- This is an entirely event-driven framework, only the client initiates events, the server reacts and can respond or notify other clients however it likes.
- This is protocol independent, any protocol (like HTTP, FTP, etc) can be written for it.
- Entirely thread-safe
**Documentation**
- [JavaDoc](http://gh.magnos.org/?r=http://clickermonkey.github.com/Falcon/)
**Example**
```java
// Create the pipe (tcp+nio), set the transmission protocol.
Pipeline pipe = new TcpPipeline(); // could be: nio.UdpPipeline, oio.TcpPipeline, oio.UdpPipeline
pipe.setDefaultProtocol(String.class);
pipe.addProtocol(new StringProtocol());
// Listen on port 9090 for clients
Server server = pipe.newServer();
server.setClientListener(new DefaultClientListener() {
public void onClientReceive(Client client, Object data) {
super.onClientReceive(client, data);
// Get all clients connected to the server
Set clients = client.getServer().getClients();
// Send all clients the data this client sent.
for (Client current : clients) {
current.send(data);
}
}
});
server.listen(9090);
// Connect 2 clients
Client client1 = pipe.newClient();
client1.connect("127.0.0.1", 9090);
Client client2 = pipe.newClient();
client2.connect("127.0.0.1", 9090);
// Send myself and client2 a message
client1.send("Hello Tom");
// Send myself and client1 a message
client2.send("Hello Beth");
// Close the clients as soon as all data is sent
client1.disconnect();
client2.disconnect();
/** processing! (waiting for data to send to server) **/
// Finally the server is finished, close it.
server.close();
```
**Builds**
- [falcon-1.0.jar](http://gh.magnos.org/?r=https://github.com/ClickerMonkey/Falcon/blob/master/build/falcon-1.0.jar?raw=true)
- [falcon-src-1.0.jar](http://gh.magnos.org/?r=https://github.com/ClickerMonkey/Falcon/blob/master/build/falcon-src-1.0.jar?raw=true) *- includes source code*
- [falcon-all-1.0.jar](http://gh.magnos.org/?r=https://github.com/ClickerMonkey/Falcon/blob/master/build/falcon-all-1.0.jar?raw=true) *- includes all dependencies*
- [falcon-all-src-1.0.jar](http://gh.magnos.org/?r=https://github.com/ClickerMonkey/Falcon/blob/master/build/falcon-all-src-1.0.jar?raw=true) *- includes all dependencies and source code*
**Dependencies**
- [taskaroo](http://gh.magnos.org/?r=https://github.com/ClickerMonkey/Taskaroo)
- [surfice](http://gh.magnos.org/?r=https://github.com/ClickerMonkey/Surfice)
- [zource](http://gh.magnos.org/?r=https://github.com/ClickerMonkey/Zource)
- [buffero](http://gh.magnos.org/?r=https://github.com/ClickerMonkey/Buffero)
- [curity](http://gh.magnos.org/?r=https://github.com/ClickerMonkey/Curity)
- [testility](http://gh.magnos.org/?r=https://github.com/ClickerMonkey/Testility) *for unit tests*
**Testing Examples**
- [Examples/org/magnos/net/examples](http://gh.magnos.org/?r=https://github.com/ClickerMonkey/Falcon/tree/master/Examples/org/magnos/net/examples)