From owner-freebsd-hackers Mon Apr 10 2:48:17 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from citadel.cequrux.com (citadel.cdsec.com [192.96.22.18]) by hub.freebsd.org (Postfix) with ESMTP id 8C8C137B8C5 for ; Mon, 10 Apr 2000 02:48:10 -0700 (PDT) (envelope-from gram@cequrux.com) Received: (from nobody@localhost) by citadel.cequrux.com (8.9.3/8.9.3) id LAA21417 for ; Mon, 10 Apr 2000 11:48:05 +0200 (SAST) Received: by citadel.cequrux.com via recvmail id 21355; Mon Apr 10 11:47:27 2000 Message-ID: <38F1A456.EAADF652@cequrux.com> Date: Mon, 10 Apr 2000 11:52:22 +0200 From: Graham Wheeler Organization: Cequrux Technologies X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 2.2.8-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: hackers@freebsd.org Subject: Determining traffic on a socket Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi all I doubt that this can be done, but it would solve me a lot of headaches if it can! I would like to know if there is a way I can, given a file descriptor (which will be a TCP socket), determine how many bytes have been sent and received through that socket since it was opened. Obviously one way is to keep a count of reads and writes, but what I really want is to have a wrapper process that can spawn arbitrary one-shot servers and then log the traffic produced and consumed by that server when it terminates. Another option is to communicate with the server via pipes, but that may break if the server needs to be able to do getsockname() and getpeername() calls. So the real solution would (I imagine) involve some kind of kernel querying. Any ideas, anyone? TIA gram -- Dr Graham Wheeler E-mail: gram@cequrux.com Director, Research and Development WWW: http://www.cequrux.com CEQURUX Technologies Phone: +27(21)423-6065 Firewalls/VPN Specialists Fax: +27(21)424-3656 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message