# Connection-oriented communication

In telecommunications and computer networking, connection-oriented communication is a communication protocol where a communication session or a semi-permanent connection is established before any useful data can be transferred. The established connection ensures that data is delivered in the correct order to the upper communication layer. The alternative is called connectionless communication, such as the datagram mode communication used by Internet Protocol (IP) and User Datagram Protocol (UDP), where data may be delivered out of order, since different network packets are routed independently and may be delivered over different paths.
Connection-oriented communication may be implemented with a circuit switched connection, or a packet-mode virtual circuit connection. In the latter case, it may use either a transport layer virtual circuit protocol such as the Transmission Control Protocol (TCP) protocol, allowing data to be delivered in order. Although the lower-layer switching is connectionless, or it may be a data link layer or network layer switching mode, where all data packets belonging to the same traffic stream are delivered over the same path, and traffic flows are identified by some connection identifier reducing the overhead of routing decisions on a packet-by-packet basis for the network.
Connection-oriented protocol services are often, but not always, reliable network services that provide acknowledgment after successful delivery and automatic repeat request functions in case of missing or corrupted data. Asynchronous Transfer Mode (ATM), Frame Relay and Multiprotocol Label Switching (MPLS) are examples of connection-oriented unreliable protocols. Simple Mail Transfer Protocol (SMTP) is an example of a connection-oriented protocol in which, if a message is not delivered, an error report is sent to the sender, making it a reliable protocol. Because they can keep track of a conversation, connection-oriented protocols are sometimes described as stateful.

## Circuit switching

Circuit switched communication, for example the public switched telephone network, ISDN, SONET/SDH and optical mesh networks, are intrinsically connection-oriented communication systems. Circuit-mode communication provides guarantees that constant bandwidth will be available, and bit stream or byte stream data will arrive in order with constant delay. The switches are reconfigured during a circuit establishment phase.

## Virtual circuit switching

Packet switched communication may also be connection-oriented, which is called virtual circuit mode communication. Due to the packet switching, the communication may suffer from variable bit rate and delay, due to varying traffic load and packet queue lengths. Connection-oriented communication does not necessarily imply reliability.

### Transport layer

Connection-oriented transport-layer protocols provide connection-oriented communications over connectionless communication systems. A connection-oriented transport layer protocol, such as TCP, may be based on a connectionless network-layer protocol such as IP, but still achieves in-order delivery of a byte-stream by means of segment sequence numbering on the sender side, packet buffering, and data packet reordering on the receiver side.

### Datalink and network layer

In a connection-oriented packet-switched data-link or network-layer protocol, all data is sent over the same path during a communication session. Rather than using complete routing information for each packet (source and destination addresses) as in connectionless datagram switching such as conventional IP routers, a connection-oriented protocol identifies traffic flows only by a channel or data stream number, often denoted virtual circuit identifier (VCI). Routing information may be provided to the network nodes during the connection establishment phase, where the VCI is defined in tables within each node. Thus, the actual packet switching and data transfer can be taken care of by fast hardware, as opposed to slower software-based routing. Typically, this connection identifier is a small integer (for example, 10 bits for Frame Relay and 24 bits for ATM). This makes network switches substantially faster.
ATM and Frame Relay, for example, are both examples of connection-oriented, unreliable data link layer protocols. Reliable connectionless protocols exist as well, for example AX.25 network layer protocol when it passes data in I-frames, but this combination is rare, and reliable-connectionless is uncommon in modern networks.
Some connection-oriented protocols have been designed or altered to accommodate both connection-oriented and connectionless data.

## Examples

Examples of connection-oriented packet-mode communication, i.e. virtual circuit mode communication:
* Asynchronous Transfer Mode
* Connection-oriented Ethernet
* Datagram Congestion Control Protocol
* Frame Relay
* General Packet Radio Service
* IPX/SPX
* Multiprotocol Label Switching
* Stream Control Transmission Protocol
* Transmission Control Protocol
* Transparent Inter-process Communication
* X.25