Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Apr 2000 11:52:22 +0200
From:      Graham Wheeler <gram@cequrux.com>
To:        hackers@freebsd.org
Subject:   Determining traffic on a socket
Message-ID:  <38F1A456.EAADF652@cequrux.com>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?38F1A456.EAADF652>