1: The main program sends a text message at the application layer.
2: After arriving at the transport layer (tcp), send text in a udp packet and wait for three messages to be accepted. Ethernet packet arrival information, ARP heavy load information, ARP aging Information
3: udp protocol package> udp_send Program
4: Group IP protocol package-> IP_send Program
Call the ARP parsing program (ARP_resolve) in the IP_send program. If the MAC address is obtained, run the Ethernet sending program. Eth_send. If yes, the sent information is cached. Wait exists.
5: Convert the ARP_reslove program. Enter the IP address and search for the MAC address in the ARP table. If the MAC address is found, IP_send is returned. If the ARP request broadcast command cannot be found.
6: Send the ARP broadcast command and call the ARP_send program: group a arp packet B calls eth_send
7: The status changes from sending to receiving, and the wait for arp flag is set.
8: return to the main program and wait for receiving the package. Then, the system receives a protocol package and unpacks the package. The packet may be an IP protocol package or an ARP packet.
9: if an arp packet is received, it may be an arp response packet or an arp request packet.
10: if it is an arp request packet, take out the sender's IP address and mac address and store it in our arp table.
A: Look up the arp table to see if it exists.
B: If the age is changed, set it to the youngest one. If the age does not exist, check whether the arp table is empty. If yes, set it to the optimum age. If there is no empty seat, the oldest will be squeezed out.
Send an arp response packet to notify the recipient of Our mac address.
11: if it is an arp response packet, we get the mac address, cancel the wait for arp flag, store the arp table, and convert it to the IP_send program.
From snicolashe's column