ChinaUnix.net
相关文章推荐:

pcap linux 示例

pcap源代码中有之么一句:pcap_t *handle = malloc(sizeof(*handle)); pcap_t是这样一个结构struct pcap { int fd; int snapshot; int linktype; int tzoff; /* timezone offset */ int offset; /* offset for proper alignment */ struct pcap_sf sf; struct pcap_md md; /* * Read buffer. */ int bufsize; u_char *buffer; u_char *bp; int cc; /* * Place holder for pcap_next(). */ u_char *pkt;...

by tanoak - C/C++ - 2005-06-16 10:22:49 阅读(806) 回复(1)

相关讨论

linux下的nc命令中,-l后跟随监听端口,-p后跟随与目标主机建立连接时的本地端口,二者不可能同时使用。 nc -l 1234 nc 127.0.0.1 1234 在端口1234建立连接,互相发送输入 nc -p 1234 -w 5 host.example.com 80 建立从本地1234端口到host.example.com的80端口连接,5秒超时 nc -u host.example.com 53 u为UDP连接 echo -n "GET / HTTP/1.0"r"n"r"n" | nc host.example.com 80 连接到主机并执行 nc -v -z host.example.com 70-80 ...

by ubuntuer - Linux文档专区 - 2010-01-12 15:12:16 阅读(1990) 回复(0)

These were writed and collected by kf701, you can use and modify them but NO WARRANTY. Contact with me : kf_701@21cn.com 程序1:检测接口的 inet_addr,netmask,broad_addr 程序2:检查接口的物理连接是否正常 程序3:更简单一点测试物理连接 程序4:调节音量 ***************************程序1**************************************** #include #include #include #include #include #include #include #includ...

by 风中残月 - Linux文档专区 - 2009-05-22 14:03:19 阅读(522) 回复(0)

• 防火墙示例-用简单规则集保护网络 防火墙的配置要求如下: 1、 拒绝所有外面传入的、向外的和转发的包。 2、 允许所有外传的TCP连接:我们这里允许的如web/telnet/ssh/ftp等外传。 3、 允许外发的TCP连接的返回封包通过防火墙,需检查封包的状态。 4、 允许向外发送UDP连接在端口53上指定域名服务器,但只允许伟入的DNS封包进入内部的域名服务器chivas。 5、 创建允许内核从一个网络接口向另一个网络接口适...

by sjhf - Linux文档专区 - 2009-03-23 11:23:41 阅读(440) 回复(0)

示例为 Client/Server 结构,通过代码演示 Client 如何建立连接,并向远程端发送数据;Server 端如何侦听系统连接请求,接收请求并建立连接,进而获取客户端发来的数据。代码虽短,却描述了整个通信过程,可对linux 下 网络编程起个抛砖引玉的作用吧 :-) Client 端代码: -------------------------------------------------------------- /* sockclnt.c*/ #include #include #include #include #include /*for struct socka...

by sinodragon21 - Linux文档专区 - 2008-08-04 12:29:14 阅读(537) 回复(0)

我们将要实现的是要得到一个子目录清单的程序,现在把许多文件处理函数集中在一起使用,程序遍历指定目录的文件,同时也要进到下级子目录中进行遍 历,这一点是将子目录递归传递到opendir中去,需要指出的是,这就决定了如果子目录嵌套过深,程序将失败返回,因为允许打开的子目录流数量是有上限 的。 源码如下: /**//* We start with the appropriate headers and then a function, printdir, which prints out the...

by sss0213 - Linux文档专区 - 2009-04-03 14:54:25 阅读(680) 回复(0)

linux系统ioctl使用示例 I love linux and open source,but I love my girl more. These were writed and collected by kf701, you can use and modify them but NO WARRANTY. Contact with me : kf_701@21cn.com 程序1:检测接口的 inet_addr,netmask,broad_addr 程序2:检查接口的物理连接是否正常 程序3:更简单一点测试物理连接 程序4:调节音量 ***************************程序1********************************...

by qfox - Linux文档专区 - 2006-06-15 21:48:22 阅读(675) 回复(0)

HA部署中,经常会遇到ARP问题.由于路由刷新慢,服务在切换后,client端访问出错.需要等到ARP表刷新后,才能正确访问. 解决方法就是使用sendarp.前段时间为它,捆扰好长时间.所以帖个例子出来.可以放在启动服务脚本中. #!/bin/bash # # iptakeover script # # Simple script to take over an IP address. # # Usage is "iptakeover {start|stop|status}" # # SENDARP is the program included with the Heartbeat program that # sends...

by NICKY.BOY - Linux文档专区 - 2006-06-07 14:48:12 阅读(1038) 回复(0)

文基于pcap 0.9.8版本,该版本发布于September 25, 2007。RHEL AS4 Update3附带的版本是0.8.3(tcpdump --version)。 一、 pcap简介 封装了OS提供的底层抓包技术,对外提供一些统一的抓包(及发送)接口。实现这些功能的其他技术包括:BPF(Berkeley Packet Filter),DLPI(Data Link Provider Interface),NIT ,linux专用的SOCKET_PACKET或PF_PACKET等。 二、 pcap linux安装 参考《INSTALL.txt》。 进入pcap源码目录,执行./co...

by xinly_chen - Linux文档专区 - 2009-11-11 16:01:50 阅读(1540) 回复(0)

我有一个较大的 pcap 文件, 但我只想取出其中的一个包 (例如第58个), 有什么工具软件可用? 多谢.

by Lei2004 - Linux论坛 - 2004-05-22 13:20:34 阅读(640) 回复(1)

我有一个较大的 pcap 文件, 但我只想取出其中的一个包 (例如第58个), 有什么工具软件可用? 多谢.

by Lei2004 - Linux系统管理 - 2004-05-22 13:20:34 阅读(564) 回复(1)