linux programming
长沙大东家
这个作者很懒,什么都没留下…
展开
-
gethostbyaddr segmentation error FAQ
p, li { white-space: pre-wrap; }struct hostent* hostEnt; hostEnt=gethostbyaddr(inet_ntoa(ptr->ip_src),sizeof(ptr->ip_src),AF_INET); if(!hostEnt) { tmp=new QStandardItem原创 2009-04-24 20:37:00 · 576 阅读 · 0 评论 -
ip结构体中len与libpcap pcap_pkthdr结构体中len区别
最近做毕业设计,搞到这里两个len搞了好久也没有搞清楚这个问题,终于在网上搜到有人回答这个问题,原地址是:http://www.cpptalk.net/request-for-code-review-vt5635.htmlIP->len means the length of the IP datagram, not MTU (I guess you meant MTU, not MSS原创 2009-05-02 18:34:00 · 2107 阅读 · 6 评论 -
ip 数据包校验和
u_short MyIPCore::checksum(u_short* data, int len){ u_long sum=0; for(;len>1;len-=2) { sum+=*data++; if(sum&0x80000000) sum=(sum&0xffff)+(sum>>16); } if(len==1)原创 2009-05-04 20:17:00 · 619 阅读 · 0 评论 -
The Sniffer's Guide to Raw Traffic
(a libpcap tutorial) · Download libpcap source from www.tcpdump.org here · Download libpcap for win32 from www.winpcap.org · Check out a better pcap tutorial here转载 2009-05-04 20:26:00 · 1892 阅读 · 0 评论 -
获取网卡地址 mac or ip or net mask
#include #include #include #include #include #include #include #include #include #define ETH_NAME "eth0" int main() {原创 2009-05-04 20:10:00 · 730 阅读 · 0 评论 -
获取系统所有IP地址
获取详细网卡信息,请参考ioctlnet/if.h 等相关文件与帮助。 struct if_nameindex * ifni, *p; int fd, numreqs = 30, n, err = -1; struct ifconf ifc; struct ifreq *ifr; if ((fd = socket (AF_INET, SOCK_DGRAM, 0转载 2009-05-04 20:13:00 · 707 阅读 · 0 评论 -
Ubuntu 14.04 64位 安装(install) ia32-libs
srcoptions1(if it works, this is the best choice):sudo dpkg --add-architecture i386sudo apt-get updatesudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386options2转载 2014-09-25 11:37:29 · 1555 阅读 · 0 评论