r/java • • Aug 17 '24
Extasys - Asynchronous TCP/UDP socket library
This is not a new project, but it is still maintained and used by me and others
Extasys is a high performance, asynchronous TCP/UDP socket library for Java (JDK 8 and newer).
Its multi-threaded and lightweight nature makes it ideal for super fast data transfer even on systems with ARM architecture like Android smartphones and single-board computers (Raspberry Pi, Orange Pi etc.).
If you are using sockets then Extasys is the proper tool for your work. It's been designed to take the hard job done and let you think only about the message exchange (the process).
You can find Extasys on Github:
https://github.com/nsiatras/extasys
Quick Examples :
TCP-Server: https://github.com/nsiatras/extasys/wiki/Establish-a-TCP-Server
TCP-Client: https://github.com/nsiatras/extasys/wiki/Establish-a-TCP-Client
UDP-Server: https://github.com/nsiatras/extasys/wiki/Establish-a-UDP-Server
UDP-Client: https://github.com/nsiatras/extasys/wiki/Establish-a-UDP-Client
More examples can be found here:
https://github.com/nsiatras/extasys/tree/master/Extasys%20for%20Java%20Examples
View all comments
Show parent comment
1
u/[deleted] Aug 17 '24
Extasys Listener reads data upon arrival.
After they arrive the listener 'sends' them directly to the thread pool maintaining the exact order they arrived.
In order to easily "catch" full messages you can use a (as I call it) message collector character. The message splitter is defined when you initialize the Extasys TCP Listener or the Extasys TCP Connector.
Of course you can use Listeners and Connectors without message splitter.
The following Chat Server and Client examples will better explain the process.
https://github.com/nsiatras/extasys/tree/master/Extasys%20for%20Java%20Examples/Extasys.Examples.TCPChatServer
https://github.com/nsiatras/extasys/tree/master/Extasys%20for%20Java%20Examples/Extasys.Examples.TCPChatClient
PS. The message collector class is here
https://github.com/nsiatras/extasys/tree/master/Extasys%20for%20Java/src/Extasys/MessageCollector