易截截图软件、单文件、免安装、纯绿色、仅160KB

linux下写程序检测ip冲突(ARP)

原理其实很简单,那就是广播一个arp包,然后recv,如果没有数据(这里要设置延时),那么说明这个ip是可用的,否则就检测这个数据是否为回复我们发出的arp的应答包.如果是则证明ip已被使用,否则继续等待.
这里可以看下busybox的dhcp中的检测程序。
networking/udhcp/arpping.c
C代码
/* vi: set sw=4 ts=4: */  
/*  
 * arpping.c  
 *  
 * Mostly stolen from: dhcpcd - DHCP client daemon  
 * by Yoichi Hariguchi <yoichi@fore.com>  
 */  
  
#include <netinet/if_ether.h>   
#include <net/if_arp.h>   
  
#include "common.h"   
#include "dhcpd.h"   
  
//这里是arp包的格式,其中的数据格式都是宏了,比如uint_8_t为无符char.   
struct arpMsg {   
    /* Ethernet header */  
    uint8_t  h_dest[6];     /* 00 destination ether addr */  
    uint8_t  h_source[6];   /* 06 source ether addr */  
    uint16_t h_proto;       /* 0c packet type ID field */  
  
    /* ARP packet */  
    uint16_t htype;         /* 0e hardware type (must be ARPHRD_ETHER) */  
    uint16_t ptype;         /* 10 protocol type (must be ETH_P_IP) */  
    uint8_t  hlen;   &nb


相关文档:

eAccelerator for linux 详解

eaccelerator.shm_size
    The amount of shared memory (in megabytes) that eAccelerator will use.
    "0" means OS default. Default value is "0".
eaccelerator.cache_dir
    The directory that is used for disk cache. eAccelerator stores precompiled code ......

LINUX培训课程!

课程简介
RH033 红帽企业Linux基础课程
适合没有使用Linux 或 UNIX 命令行的经验,但想掌握使用和定制红帽 Linux工作站环境所需技能的人员。
RH133 系统管理
适用于想通过学习红帽企业Linux 的系统管理技能,自己可以在现有网络中添加和配置工作站的用户。
这一课程的最后一天为 RH202 红帽认证技师认证操作考试。
RH ......

在Linux上配置COM口

在linux系统上同样可以配置串口,使用串口来与其他设备进行通信。
在配置串口前,我们有取得linux系统的root权限,这个很重要。否则无法完成下面步骤。
1.切换到root用户.
[root@localhost ~]#su root
2. 查找有效的串设备.
[root@localhost ~]#cat /proc/devices
Character devices:
  1 mem
  4 /dev/v ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号