traffic counter in linux or bsd

G

guilherme.oliveira

Hi.

What is the simple way to do a traffic counter in C ?
I'm searching but there aren't any records of total transffers in /proc
to get the value.

Thanks in advance.
 
W

Walter Roberson

What is the simple way to do a traffic counter in C ?

Does it have to be able to handle multiple lanes? Does it have
to be able to figure out how many axels the trucks have? Does it
have to be able to handle bicycles? Does it have to be able to handle
when vehicles encounter the counting device at an angle?
I'm searching but there aren't any records of total transffers in /proc
to get the value.

The C standards don't just not know anything about /proc :
the C standards don't have any concept of "transfers".

Possibly you should inquire in sci.engr.civil or
comp.programming.embedded -- or one of the human resources
newsgroups might be able to help with assessing total transfers.
 
G

guilherme.oliveira

Sorry. I didn't give the right question.
I was asking about network traffic in a network interface:

I have a firewall that when it reachs the 2GB limits it must close the
interface and activate again in day 1 of each month.

I have already done the daemon with forks and i was starting to code
the main() but I can't find the any numbers of traffic already done in
/proc or ifconfig.

Any help please ?
 
W

Walter Roberson

Sorry. I didn't give the right question.
I was asking about network traffic in a network interface:
I have a firewall that when it reachs the 2GB limits it must close the
interface and activate again in day 1 of each month.
I have already done the daemon with forks and i was starting to code
the main() but I can't find the any numbers of traffic already done in
/proc or ifconfig.

Well, like I said, the C standards don't know anything about /proc .
They don't know anything about ifconfig either. Or daemons, or forks,
or networks, or interfaces, or firewalls.

Have you tried the obvious: reading the netstat source code ?
 
K

Keith Thompson

Sorry. I didn't give the right question.
I was asking about network traffic in a network interface:

I have a firewall that when it reachs the 2GB limits it must close the
interface and activate again in day 1 of each month.

I have already done the daemon with forks and i was starting to code
the main() but I can't find the any numbers of traffic already done in
/proc or ifconfig.

Any help please ?

Not here. Standard C, which is what we discuss here, has no way to do
what you're asking for. Try comp.unix.programmer.

And learn to post proper followups.
Read <http://cfaj.freeshell.org/google/>.
 
C

CBFalconer

Sorry. I didn't give the right question.
I was asking about network traffic in a network interface:

I have a firewall that when it reachs the 2GB limits it must close
the interface and activate again in day 1 of each month.

I have already done the daemon with forks and i was starting to
code the main() but I can't find the any numbers of traffic already
done in /proc or ifconfig.

Any help please ?

Whatever it is it is apparently off topic, but without proper
context it is hard to tell where to send you. You should have
monitored the newsgroup for a period to discover the subject of
discussion, which in this case is the _standard_ C language.

In this particular case it doesn't matter too much, but in general
on usenet you should realize that readers may very well not have
convenient access to previous articles in a thread. That means
that your reply articles should include adequate context, so that
they stand by themselves. Google is NOT usenet, it is only a very
poor interface to the real usenet system. To include proper
context when using google, see my sig. below. Please be sure to
read the referenced URLs.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top