As can be seen, TCP/IP is a protocol group, can be divided into three levels: Network layer, Transport layer and application layer.
At the network layer are IP protocols, ICMP protocols, ARP protocols, RARP protocols, and BOOTP protocols.
There are TCP protocols and UDP protocols in the transport layer.
In the application layer, there are FTP, HTTP, TELNET, SMTP, DNS and other protocols.
is also a description of the relationship.
Reference: https://krystalchisholm.wordpress.com/2010/11/24/chapter-17/
In addition, we often talk about the location of the Socket such as:
A socket is an intermediate software abstraction layer that the application layer communicates with the TCP/IP protocol family, which is a set of interfaces.
In design mode, the socket is actually a façade mode, it is the complex TCP/IP protocol family hidden behind the socket interface, for the user, a set of simple interface is all, let the socket to organize data to meet the specified protocol.
Reference: http://blog.csdn.net/xijiaohuangcao/article/details/6105623
The difference between TCP UDP from the coding point of view is as follows:
TCP communication requires server-side listening Listen, receiving client connection request accept, waiting for client connect to establish a connection before sending and receiving packets (recv/send).
However, the concept of UDP server and client is not obvious, the server side is the receiving end need to bind the port, waiting for the arrival of the client's data. Subsequent data can be sent and received (RECVFROM/SENDTO) work.
Reference: http://blog.csdn.net/ce123_zhouwei/article/details/8976006
http://blog.csdn.net/kerry0071/article/details/39348163
Several classic graphs of HTTP TCP UDP Socket relationships