1. What is TCP/IP,UDP?
2. where is the socket?
3. What is a socket?
4. There are many frameworks, why are you still starting from the socket?
5. Linux C Socket Simple Example
1. What is TCP/IP ,UDP ?
TCP/IP (transmission Control protocol/internet Protocol) is a protocol/inter-network protocol, an industry-standard set of protocols designed for wide area networks (WANs).
UDP (user Data Protocol, Subscriber Datagram Protocol) is the protocol that corresponds to TCP. It is a part of the TCP/IP protocol family.
The following diagram illustrates the relationship of these protocols.
2.Socket where is it?
3.Socket What is it?
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, thesocket 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.
Façade mode, in its own words, is the system to provide a single interface to the outside world does not need to understand the internal implementation.
4. There are many frameworks, why are you still starting from the socket?
There are many cross-platform network programming frameworks, such as the ssh,c/c++ boost in Java.
There are many distributed frameworks, such as Hadoop.
My task is to make a C/C + + program distributed, the requirements of the environment, the basic belongs to pure computing, the results are very small. So the socket is selected.
It is important that sockets are the basis for distributed, cloud computing, and network programming, and that learning about sockets facilitates understanding of other frameworks.
Is the basic process of socket programming:
5.Linux C Socket Simple instance with detailed comment
The program is a simple "back-up", the client sends the console input information to the server side, the server returns information as is.
Server-side:
View Code
Client:
View Code
Perform:
Client
Server-side
Linux C Socket Programming principle and simple example