Package Network - Palamecia/mint GitHub Wiki
The Network
package provides classes and functions to interacte with a network.
This package provides 3 main classes:
- The Network.EndPoint interface allow to describe a network endpoint by providing informations used to access a device using a set of specific protocols of the layers 1 to 4 of the OSI model.
- The Network.AsynchronousChannel class handle asynchronous exchanges with a device. This device is described by an instance of Network.EndPoint or a derived class. The Network.SynchronousChannel can also be used to perform exchanges synchronously.
- The Network.Scheduler class synchronize exchanges. It manages a set of channels described by an instance of Network.AsynchronousChannel or a derived class and can work synchronously or asynchronously using a thread.
This package also provides a set of protocol specific client and server classes that implement the layers 5 to 7 of the OSI model. That allow basic communication with a device using a specific protocol.
Example:
load network.scheduler
load network.endpoints.tcpip
load network.protocol.http.client
Network.Scheduler.instance().startSynchronizationLoop()
if client = Network.Http.Client(Network.TcpIp(server_host, server_port)) {
client.onMessage = def (self, channel) {
send_to_browser(self.read())
}
client.watch()
client.connect()
// ...
client.close()
client.unwatch()
}
Network.Scheduler.instance().stopSynchronizationLoop()
- Network.IpSocketOption
- Network.IpV4SocketOption
- Network.IpV6SocketOption
- Network.SocketOption
- Network.TcpSocketOption
- Network.AsynchronousChannel
- Network.DataSerializer
- Network.Datagram
- Network.DatagramSerializer
- Network.EndPoint
- Network.IpEndPoint
- Network.IpV4MulticastGroup
- Network.IpV4MulticastSourceGroup
- Network.IpV6MulticastGroup
- Network.Scheduler
- Network.ServerSerializer
- Network.SocketLinger
- Network.SocketTime
- Network.SynchronousChannel
- Network.TcpIp
- Network.TextSerializer
- Network.UdpIp