Byte stream

From Wikipedia, the free encyclopedia

In computer science, a byte stream is a bit stream, in which data bits are grouped into units, called bytes.

In computer networking the term octet stream is sometimes used to refer to the same thing; it emphasizes the use of bytes having the length of 8 bits, known as octets. The size of a byte was not standard when the term was introduced, whereas on most modern computers byte is a synonym of octet.

Formally, a byte stream is a certain abstraction, a communication channel down which one entity can send a sequence of bytes to the entity on the other end. Such channel is often bidirectional, but sometimes unidirectional. In almost all instances, the channel has the property that it is reliable; i.e. the exact same bytes emerge, in the exact same order, at the other end.

Less formally, one can think of it as a conduit between the two entities; one entity can insert bytes into the conduit, and the other entity then receives them. This conduit can be ephemeral or persistent.

[edit] Examples

On most operating systems, including Unix-like and Windows, access of any file from a process is an example of a byte stream. In particular each process has three standard streams, that are examples of unidirectional byte streams. A pipe mechanism is often used to connect them between processes, to enable process-to-process byte streams.

One well-known example of a communication protocol which provides a byte-stream service to its clients is the Transmission Control Protocol (TCP) of the Internet protocol suite, which provides a bidirectional byte stream.

TCP is being used to bring you this Web page.

The Internet media type for an arbitrary byte stream is application/octet-stream. Other media types are defined for byte streams in well-known formats.

[edit] See also

Languages