3.3 The Two Families of Sockets

Basically, the process library supports two families of sockets: stream sockets and binary sockets. Both are implemented using basicsocket.

A stream socket is suitable for transferring data which is readable for human beings, such as the data transferred in a UNIX talk session, or the more formal communication between a mail program and an SMTP mail server. A streamSocket is a stream, so you may put, get etc. However, it is also possible to use this kind of socket to transfer arbitrary binary data, as no conversion or translation is performed. This may be used to connect to existing services with a known binary protocol.

A binary socket is guaranteed to transfer any given block of arbitrary bytes unmodified, but you must always specify the length of the data block when sending. To enable cross-platform communication, the headers of the datablocks are modified internally. The current implementation make little-endian machines (e.g. machines running Linux or Windows NT) transmit their package headers in the format used by big-endian machines. It is your responsebility that the contents of the datablocks are in a format understood by the receiver.

In general, you must have a way of choosing either a binary or a stream variant of a connection to be established, because it is not possible to change a streamSocket into a binarySocket on the same connection, or vice versa. And each socket object models one connection, so it is not possible to use the same socket object for several different connections - use a fresh object each time instead. For socketGenerators, of course, this one-shot-restriction does not apply. See below.

Process Libraries - Reference Manual
© 1994-2002 Mjølner Informatics
[Modified: Friday October 20th 2000 at 14:22]