The main function of TCP is to provide a reliable, ordered, and error-checked delivery of a stream of bytes between applications running on hosts communicating via an IP network.