For a message based communication, each message is sent to an explicitly specified receiver. For a connection based communication, at first a connection between two parties is established. From that point, messages can be transmitted via this connection without any explicit reference to their destination. Here, the model of communication is connection oriented.
For operating systems that support a notion of standard channels for receiving input and delivering output and possibly other things, it is possible for the communicating processes to be unaware (i.e. independent) of the fact that standard input comes from another process or that standard output goes to another process: It all looks the same as if the data came from a keyboard and went to a display or whatever. On the other hand, this level of abstraction implies that the connection lifetime will be the lifetime of the process and that there cannot be more connections than standard channels. Like standard output and standard input, each connection only supports sending data in one direction. Pipes establish this kind of connections. Use the pattern pipe.
To implement more elaborate patterns of communication, one must be able to create and destroy connections during the execution of a process, and to explicitly choose with whom to communicate. Sockets are used for this, and with sockets, every connection is two-way. Sockets come in two main variants: passive and active. A passive socket is used to define a name, which may be used by active sockets when establishing an actual connection. The interplay is like:
I.e. active sockets connect by name, and more than one connection may be established by means of one passive socket. The name is actually a pair whose first part is an identification of the host (its IP address) and whose second part is an integer (the port number). This pair is unique for each passive socket, at least from the time where the operating system accepts registration of the name until the passive socket is closed. After that, the pair may be reused, that is: the port number may be reused on the given host, if the operating system wishes to do so.
Passive: "Here I am! My name is Bob" ... Active-1: "I want to speak with Bob" Passive(Bob): "OK, here's a connection" ... Active-2: "I want to speak with Bob" Passive(Bob): "OK, here's a connection" ... Active-3: "I want to speak with Cindy" (Error: Here's no such thing as "Cindy") ...
In this library, sockets are also divided along another axis, namely into stream sockets and binary sockets. Stream sockets are specializations of the basic stream pattern, and support textual communication. Binary sockets support transfers of blocks of data with a well-known size.
The patterns related to these concepts are: StreamSocket, BinarySocket and SocketGenerator. SocketGenerators are used to accept incoming connection requests. When a request arrives, a new socket of the specified type is created and connected to the requesting party.
|Process Libraries - Reference Manual||© 1994-2002 Mjølner Informatics||
[Modified: Friday October 20th 2000 at 14:22]