From owner-freebsd-questions Thu Jul 4 15:33:35 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9E02737B400 for ; Thu, 4 Jul 2002 15:33:33 -0700 (PDT) Received: from Danovitsch.dnsq.org (b74143.upc-b.chello.nl [212.83.74.143]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6050D43E09 for ; Thu, 4 Jul 2002 15:33:32 -0700 (PDT) (envelope-from Danovitsch@Danovitsch.dnsq.org) Received: from FreeBSD.Danovitsch.LAN (b83007.upc-b.chello.nl [212.83.83.7]) by Danovitsch.dnsq.org (8.11.3/8.11.3) with SMTP id g64MVjt65669 for ; Fri, 5 Jul 2002 00:31:45 +0200 (CEST) (envelope-from Danovitsch@Danovitsch.dnsq.org) Content-Type: text/plain; charset="iso-8859-1" From: "Daan Vreeken [PA4DAN]" Reply-To: Danovitsch@Danovitsch.dnsq.org To: FreeBSD-Questions@FreeBSD.org Subject: Re: ICMP Date: Fri, 5 Jul 2002 00:42:52 +0200 X-Mailer: KMail [version 1.2] MIME-Version: 1.0 Message-Id: <02070500425202.00991@FreeBSD.Danovitsch.LAN> Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thursday 04 July 2002 01:52, you wrote: > Hi all > > The really should be a FreeBSD-Programmer@FreeBSD.org, but never mind > > :-) > > I have been playing with socket programming for some time now and have > moved on to raw sockets. (I don't use libnet or libpcap, because I first > want to learn it from the bottom). > I know how to send ICMP packets, but how do I receive? I can "take over" > the hole networkcard and read all packets, but I just want the ones for > my connection. If I set up a raw socket and send an ICMP I can get the > response (because the ICMP have an ID-feild?), but that if I have setup > a SOCK_STREAM or SOCK_DGRAM? How can I then detect ICMP? Have you looked at how they do it in the "ping" program? ( see /usr/src/sbin/ping/ping.c ) grtz, Daan To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message