ChinaUnix.net
相关文章推荐:

ping程序

/bin/ping 程序中不是有 socket(AF_INET, SOCK_RAW, proto->p_proto) setsockopt(s, SOL_SOCKET, SO_DONTROUTE, &on, sizeof(on)); 应该只有root权限能用, 为什么普通用户也可以用呀

by x911 - C/C++ - 2006-06-09 11:26:40 阅读(1423) 回复(5)

相关讨论

大部分人用ping命令只是作为查看另一个系统的网络连接是否正常的一种简单方法。在这篇文章中,作者将介绍如何用C语言编写一个模拟ping命令功能的程序。 ping命令是用来查看网络上另一个主机系统的网络连接是否正常的一个工具。ping命令的工作原理是:向网络上的另一个主机系统发送ICMP报文,如果指定系统得到了报文,它将把报文一模一样地传回给发送者,这有点象潜水艇声纳系统中使用的发声装置。 例如,在Linux终端上执行ping l...

by vicgates - Linux文档专区 - 2008-11-15 10:21:13 阅读(1203) 回复(0)

static void* rcv_msg(void *ptr) {     int sd,ret;     struct pong_msg_st rmsg;     time_t time2;     struct sigaction sa,osa;     pthread_detach(pthread_self());     sa.sa_sigaction=int_handler;     sigemptyset(&sa.sa_mask);     sa.sa_flag...

by hightallyht - Linux环境编程 - 2008-11-10 00:12:47 阅读(1675) 回复(7)

大部分人用ping命令只是作为查看另一个系统的网络连接是否正常的一种简单方法。在这篇文章中,作者将介绍如何用C语言编写一个模拟ping命令功能的程序。 ping命令是用来查看网络上另一个主机系统的网络连接是否正常的一个工具。ping命令的工作原理是:向网络上的另一个主机系统发送ICMP报文,如果指定系统得到了报文,它将把报文一模一样地传回给发送者,这有点象潜水艇声纳系统中使用的发声装置。 例如,在Linux终端上执行ping lo...

by lijinming119 - Linux文档专区 - 2008-09-21 20:58:00 阅读(716) 回复(0)

不是我自己写的,在学Python,所以对源码很感兴趣. 贴出来给同样有兴趣的朋友看看. #!/usr/bin/env python # -*- coding: iso-8859-1 -*- """ping.py ping.py uses the ICMP protocol's mandatory ECHO_REQUEST datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway. Copyright (C) 2004 - Lars Strand ; This program is free software; you can redistribute it and/or modify it under the terms of the...

by neilton - Python文档中心 - 2006-05-07 09:18:09 阅读(1567) 回复(0)

发信人: matrix (矩阵), 信区: NetPrg 标 题: ping程序源代码 发信站: 牡丹园 (Mon Jul 22 09:33:59 2002) , 站内信件 // Module Name: Ping.c // // Description: // This sample illustrates how an ICMP ping app can be written // using the SOCK_RAW socket type and IPPROTO_ICMP protocol. // By creating a raw socket, the underlying layer does not change // the protocol header so that when we submi...

by ghostzhu - Linux文档专区 - 2006-01-05 08:48:46 阅读(999) 回复(0)

我写了个ping程序,在unix下面只能用root才能运行,是因为使用了原始套接字SOCK_RAW,请问还有没有别的方法实现ping程序,不需要root就能运行的啊~,有的话怎么实现呢?

by page - 程序开发 - 2005-12-09 11:03:53 阅读(832) 回复(2)

我写了个ping程序,在unix下面只能用root才能运行,是因为使用了原始套接字SOCK_RAW,请问还有没有别的方法实现ping程序,不需要root就能运行的啊~,有的话怎么实现呢?

by page - Linux环境编程 - 2005-12-09 11:03:53 阅读(1475) 回复(2)

在永远的UNIX上,下的PING源码在linux编译通过后(http://fanqiang.chinaunix.net/program/netpro/2001-05-12/1979.shtml),可以PING本机,为什么ping其他机器时,就会有问题。似乎是组塞在size = recvfrom(sock, buf, sizeof(buf), 0, (struct sockaddr *)&it, &namelen); 这句上了,请高手指教。

by xujunxp - C/C++ - 2005-08-31 17:02:57 阅读(1119) 回复(4)

// Module Name: Ping.c // // Description: // This sample illustrates how an ICMP ping app can be written // using the SOCK_RAW socket type and IPPROTO_ICMP protocol. // By creating a raw socket, the underlying layer does not change // the protocol header so that when we submit the ICMP header // nothing is changed so that the receiving end will see an // ICMP packet. Additionally, we use the reco...

by proprac - C/C++ - 2003-10-30 08:50:39 阅读(2673) 回复(4)

/************关于本文档******************************************** *filename: ping.c *purpose: 实现简单的ping程序目的 *wrote by: fanyunfei(yinshulei5211314@yahoo.com.cn) *date time:2007-01-30 20:03 *********************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include #define...

by 只爱殷澍蕾 - Linux文档专区 - 2007-01-30 19:57:09 阅读(806) 回复(0)