network.sockets - Palamecia/mint GitHub Wiki
Module network.sockets
Description
This module describes how to implement a network socket in Mint.
A concrete socket implementation should inherit Network.Socket and provide standard lifecycle methods that the higher-level channel and protocol classes expect. The implementation owns the low-level handle and updates the socket state as operations progress.
[!WARNING] The constructor of a socket implementation must call the base constructor before any other operation.
class MySocketClass : Network.Socket { const def new(self, ...) { if self = Network.Socket.new(self) { // initialize the low-level handle and state return self } } }
A typical implementation provides the following methods:
connectandfinalizeConnectionto establish or complete a client connection.readandwriteto exchange data as instances of Serializer.DataStream.bind,listen, andacceptto prepare the socket as a server and accept incoming peers.shutdownandcloseto shut the socket down cleanly.getHandle,isNonBlocking, andsetNonBlockingto expose the low-level handle and readiness behavior.
The implementation should also update the socket state with Network.Socket.State and raise Exception.SocketError on failures so higher-level wrappers such as Network.Channel, Network.AsyncChannel, and Network.EventChannel can react appropriately to the result.
Packages
Enums
- Network.IpSocketOption
- Network.IpV4SocketOption
- Network.IpV6SocketOption
- Network.LocalSocketOption
- Network.TcpSocketOption
Classes
- Network.AsyncIpSocket
- Network.AsyncLocalSocket
- Network.AsyncLocalSocket.AcceptOperation
- Network.AsyncLocalSocket.ConnectOperation
- Network.AsyncLocalSocket.ReadOperation
- Network.AsyncLocalSocket.ReadSomeOperation
- Network.AsyncLocalSocket.WriteOperation
- Network.AsyncTcpSocket
- Network.AsyncTcpSocket.AcceptOperation
- Network.AsyncTcpSocket.ConnectOperation
- Network.AsyncTcpSocket.ReadOperation
- Network.AsyncTcpSocket.ReadSomeOperation
- Network.AsyncTcpSocket.WriteOperation
- Network.AsyncUdpSocket
- Network.AsyncUdpSocket.ReadFromOperation
- Network.AsyncUdpSocket.ReadOperation
- Network.AsyncUdpSocket.WriteOperation
- Network.AsyncUdpSocket.WriteToOperation
- Network.IpSocket
- Network.IpV4MulticastGroup
- Network.IpV4MulticastSourceGroup
- Network.IpV6MulticastGroup
- Network.LocalSocket
- Network.StdioSocket
- Network.TcpSocket
- Network.UdpSocket