上一页 1 ··· 7 8 9 10 11 12 下一页
摘要: 我用以下的方式安装libpcap,./configuremakemake install并且用下面的代码测试:#include <stdio.h>#include <stdlib.h>#include <pcap.h>int main( int argc, char** argv ){ char *dev, errbuf[PCAP_ERRBUF_SIZE]; dev = pcap_lookupdev( errbuf ); if ( dev == NULL ) { fprintf( stderr, "couldn't find default 阅读全文
posted @ 2011-03-11 12:59 lxgeek 阅读(543) 评论(0) 推荐(0) 编辑
摘要: 使用pppoeconf命令拨号启用有线连接:sudo ifconfig eth0 up在终端中输入:sudo pppoeconf一个基于文本菜单的程序会指导你进行下面的步骤:1. 确认以太网卡已被检测到。2. 输入你的用户名(由ISP所提供 注意:输入时请先清除输入框中的“username“,否则可能造成验证错误)。3. 输入你的密码(由ISP所提供)。4. 如果你已经配置了一个PPPoE的连接,会通知你这个连接将会被修改。5. 弹出一个选项:你被询问是否需要'noauth'和'defaultroute'选项和去掉'nodetach',这里选择& 阅读全文
posted @ 2011-03-01 21:19 lxgeek 阅读(518) 评论(1) 推荐(0) 编辑
摘要: 在看 学习shell中练习的代码#!/bin/bash# User can keyin filename to touch 3 new files.PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/gamesexport PATHecho "I will use 'touch' command to create 3 files."read -p "Please input the filename what you want: " fileuse 阅读全文
posted @ 2011-02-23 15:58 lxgeek 阅读(1927) 评论(0) 推荐(0) 编辑
摘要: 在linux的源码中对于fd_set结构体是这样定义:#undef __NFDBITS#define __NFDBITS (8 * sizeof(unsigned long))#undef __FD_SETSIZE#define __FD_SETSIZE 1024#undef __FDSET_LONGS#define __FDSET_LONGS (__FD_SETSIZE/__NFDBITS )typedef struct { unsigned long fds_bits [__FDSET_LONGS]; } fd_set;并没有fd_count 和 fd_array,而fd_count和fd 阅读全文
posted @ 2011-02-23 11:13 lxgeek 阅读(1509) 评论(2) 推荐(0) 编辑
摘要: #include <stdio.h>#include <stdlib.h>typedef struct { int a;} abc;struct tcp_server{ struct abc b;};int main( int argc, char** argv ){}用gcc编译的时候会出现:test22.c:11: error: field ‘b’ has incomplete typeabc 本来就是 struct { int a}; 的别名,然后使用的时候又加了struct.所以出现了这个问题。 阅读全文
posted @ 2011-02-23 11:04 lxgeek 阅读(267) 评论(1) 推荐(0) 编辑
摘要: 在看别人代码的时候看到了Tail Queues,于是查了 manual,但是还不是很懂,于是查了源码,明白了些。TAILQ_HEAD(HEADNAME, TYPE) head; where HEADNAME is the name of the structure to be defined, and TYPE is the type of the elements to be linked into the tail queue. A pointer to the head of the tail queue.在源码中这样实现:The macro CIRCLEQ_INIT initiali 阅读全文
posted @ 2011-02-11 17:10 lxgeek 阅读(970) 评论(0) 推荐(0) 编辑
摘要: /* malloc a fd_set on the heap, to make it dependent from FD_SETSIZE. make sure fd_count > FD_SETSIZE. */ #define NEW_FD_SET( fd_count ) \ (struct fd_set*) malloc( sizeof( struct fd_set ... 阅读全文
posted @ 2011-02-09 17:17 lxgeek 阅读(1020) 评论(2) 推荐(0) 编辑
摘要: #include #include #include #include char localtm[80]; void getlocaltime() { time_t now; //实例化time_t结构 struct tm *timenow; //实例化tm结构指针 time(&now); //time函数读取现在的时间(国际... 阅读全文
posted @ 2011-02-08 18:06 lxgeek 阅读(1873) 评论(0) 推荐(0) 编辑
摘要: <!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->#include <sys/sock 阅读全文
posted @ 2011-02-04 21:47 lxgeek 阅读(578) 评论(0) 推荐(0) 编辑
摘要: 今天在调试网络编程中的代码中的问题,对== 和 = 的优先级应用欠妥写了个 example:#include stdio.h 阅读全文
posted @ 2011-01-18 12:54 lxgeek 阅读(354) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 下一页