The arp_cache_ip function determines whether the ARP table has a MAC (ethernet) address entry for the requested IP address. If an entry does not exist, the function forces the TCPnet system to resolve and cache the MAC address into the internal ARP table buffer. To resolve the MAC address, the TCPnet system sends an arp request to the network. The argument ipadr points to a buffer containing the four octets of the dotted decimal IP address to be resolved. The argument type specifies whether the IP address is fixed or temporary. This consequently determines whether or not the TCPnet system automatically refreshes the IP address entry in the ARP cache. | Type | Description |
|---|
| ARP_TEMP_IP | The IP address is temporary, and thus TCPnet removes the IP address entry from the ARP cache after a timeout. | | ARP_FIXED_IP | The IP address is fixed, and thus TCPnet's ARP module automatically refreshes the IP address entry after the timeout. |
The arp_cache_ip function is in the RL-TCPnet library. The prototype is defined in rtl.h. note - Only the ethernet network interface needs to use the arp_cache_ip function. There is no ARP protocol for the PPP and SLIP network interfaces.
- The arp_cache_ip function is primarily useful before sending the first UDP packet. The function is not necessary before sending TCP packets because the TCP module can retransmit the packet if the remote machine did not receive the packet.
|