1. TCP/IP Protocol Application
Understanding the TCP/IP protocol: TCP is the control transmission protocol, mainly used to process data packets,
IP is an Internet protocol, mainly responsible for data transmission paths.
The connection model is as follows: Application-Tcp protocol-IP protocol-Ethernet device-Internet
Layer for communication between applications: simple Email transmission (SMTP), file transfer protocol (FTP), and network remote access protocol (Telnet)
Transport Layer: In this layer, it provides data transmission between nodes and communication services between applications, as long as the function is data formatting, data validation and loss retransmission. For example, Transmission Control Protocol (TCP ),
User Datagram Protocol (UDP), TCP and UDP add data to the data packet and transmit it to the next layer. This layer is responsible for transmitting data and confirming that the data has been delivered and received
Network Layer: provides basic data packet transmission functions to enable each packet to reach the target host, such as Internet Protocol 9 (IP)
Network Interface Layer: receives and transmits IP data packets, receives physical frames from the network, extracts IP data packets, and transfers them to the next layer to manage the actual network media, define how to use the actual network to transmit data
2. Understand Scoket Protocol
Scoket is a network communication protocol over TCP/IP. Sockets can be seen as endpoints between communication hosts, forming a programming interface between a single host and the entire network.
The socket exists in the communication domain (the communication domain is an abstract concept introduced to process General threads through socket communication ). Different sockets in the same domain can communicate with each other.
There are two types of sockets: Synchronous socket and asynchronous socket.
3. synchronous socket
Using synchronous sockets technology to practice five aspects of network communication: Host resolution, host binding, port listening, data connection, and data transmission
1. Define host objects
There are two methods to define host objects. One is to directly use the IPEndPoint class. Using its constructor to specify the IPEndPoint constructor of the Host object has two parameters, the first parameter indicates the long IP address of the host, and the second parameter indicates the host port.
IPEndPoint myServer = new ipendpoints (1234.80 );
The second method is the IPAddress class, which converts the string to the IP address format.