Sequenced socket server
This MR implements the Sequenced Socket library. More specifically, it implements a sequenced UNIX domain socket, which can receive clients attempting to connect to it. The connected client can then have its messages read.
Notably, this MR implements only the basic functionality we actually need. There are more features to a fully functioning sequenced sockets library, but all functionality we don't plan to use is ignored. We should consider the degree to which we want to implement such features, or even whether we want to support different types of sockets.
The MR's core logic (so everything not related to setting up a new project) consists of two parts:
- CSocket: A direct 1-to-1 mirror of the C library, using JNA to allow calling C libraries from Kotlin.
- ServerSocket and ClientSocket: A more Kotlin-like approach to the sockets. It uses CSocket to make the sequenced socket work but actually allows for code like
ServerSocket().start()
rather than:
val serverSocket = CSocket.INSTANCE.socket(AddressFamily.AF_UNIX, SocketType.SOCK_SEQPACKET, 0)
CSocket.INSTANCE.bind(serverSocket, address, address.size())
CSocket.INSTANCE.listen(serverSocket, 5)
The idea is that library users actually use the ServerSocket and ClientSocket, while CSocket is purely used within the library to make the functionality work.
I am aware that the publishing is not properly set up yet with the project.