![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
Classes | |
| class | ClientSocket |
| class | Connection |
| class | Exception |
| class | ServerSocket |
| class | Server |
This module provides basic classes to implement network access in a portable way.
For a client, the basic class is the ClientSocket that opens a bidirectional TCP/IP connection to a remote socket. The input and output streams are provided using elm::io::InStream and elm::io::OutStream.
In the opposite, the ServerSocket provides basic facilities to build a server that opens a connection on a random or a selected port and listen for connection. A Connection is manages a socket and provides access using elm::io::InStream and elm::io::Outstream.
The Server wraps around a ServerSocket and implements a waiting loop for connection. When a connection is established, the protected function Server::onConnection() is called to let implement the behavior of the server application itself. Below is an example of echo server: