From Clean
Jump to navigationJump to search

The TCP library contains functions and data structures to write Clean programs that communicate by means of the TCP protocol (transmission control protocol). This protocol lets you establish channels to send and receive data via a network.

The library can be divided into two parts: The synchronous and the asynchronous part.

The synchronous part is applicable in non event driven programs (e.g. simple console applications) as well as in event driven programs (GUI-applications using the Object I/O Library). Many function calls can _block_ the whole Clean program until the corresponding action has been completed. For instance synchronously receiving data via a channel can block for a long time until the data arrives via the network. In that time the program does not proceed in it's execution.

Although the synchronous part is easier to use it's blocking behaviour could raise problems in conjunction with GUI (graphical user interface) programs. These problems can be circumvented by using the asynchronous (event driven) part of this library.

The library further offers acces to the DNS (domain name service).

The library is integrated with the Object I/O library. The tutorial to the Object I/O library contains the documentation for this package.

The TCP library consists of the following library modules:

Name Description
StdChannels contains operations to send and receive on channels.
StdEventTCP contains functions for using event driven TCP.
StdStringChannels defines instances to send and receive strings.
StdTCP convenience module to easily import the TCP API.
StdTCPChannels defines instances for most of the classes defined in StdChannels.
StdTCPDef contains various type definitions needed for event driven communication.