資源描述:
《ARP協(xié)議的c語言實(shí)現(xiàn)源代碼.docx》由會員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫。
1、ARP協(xié)議的c語言實(shí)現(xiàn)源代碼【轉(zhuǎn)載】收裁什么是ARP協(xié)議英文原義:AddressResolutionProtocol中文釋義:(RFC-826)地址解析協(xié)議#iiiclude#iiiclude#iiiclude#include#iiiclude#iiiclude#iiiclude#include#iiiclude#iiiclude<
2、svs/uio.h>J#iiicludeJ#iiicludeJ#include#iiiclude#iiiclude#iiiclude#iiiclude#iiiclude#iiiclude#iiiclude#iiicl
3、ude#iiiclude#include#definesrc.addrH192.168.0.239H#definedeviceMethOM#definefill_bufMaaaaaaaaaaaaMhitsocket.id;char*target=src_addr;mtsend_count=0;mtrecv_count=0;stmctiii_addisic,dst;stmctsockaddrjlme,he;stmctt
4、iinevalsend_time,recv_time;stiuctiii_addiget_src_ip(chai-*devices)(stmctsockaddr_iiisaddr;hitsock_id=socket(AF_INET,SOCK_DGRANI,0);if(sock_id<0){perror(MsocketM);exit(2);}if(devices){if(setsockopt(sock_id.SOL_SOCKET,SO_BINDTODEVICE,device,strlen(device
5、)+l)==-1)penor(HXVARNING:interfaceisignoredH);}mtalen=sizeof(saddr);meniset(&saddi