A lightweight and flexible Java networking library for building custom networked applications.
It provides packet-oriented TCP connections, fine-grained socket option control, and optional encryption with JCE ciphers.
Add the dependency from Maven Central:
<dependency>
<groupId>io.github.generaloss</groupId>
<artifactId>network-forge</artifactId>
<version>25.10.2</version>
</dependency>
TCPServer server = new TCPServer();
server.setOnConnect(connection -> {
connection.send("Hello, client!");
});
server.setOnReceive((senderConnection, byteArray) -> {
String received = new String(byteArray);
System.out.println(received); // Output: Hello, server!
});
server.setOnDisconnect((connection, reason, e) -> {
server.close(); // close server
});
server.run(5555);
TCPClient client = new TCPClient();
client.setOnReceive((connection, byteArray) -> {
String received = new String(byteArray);
System.out.println(received); // Output: Hello, client!
client.close(); // disconnect client
});
client.connect("localhost", 5555);
client.send("Hello, server!");
See the Wiki for full guides and API documentation.
- Resource Flow - utility library used by Network Forge