473,408 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

traffic counter in linux or bsd

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.

May 30 '06 #1
5 3383
In article <11**********************@g10g2000cwb.googlegroups .com>,
<gu****************@gmail.com> wrote:
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.
--
Is there any thing whereof it may be said, See, this is new? It hath
been already of old time, which was before us. -- Ecclesiastes
May 30 '06 #2
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 ?

May 30 '06 #3
In article <11**********************@u72g2000cwu.googlegroups .com>,
<gu****************@gmail.com> wrote:
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 ?
--
All is vanity. -- Ecclesiastes
May 30 '06 #4
gu****************@gmail.com writes:
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/>.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
May 30 '06 #5
gu****************@gmail.com wrote:

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/>
Jun 1 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: m-flo | last post by:
Hi i have web site for educational stuff.. and i need to upload some videos (mpeg,avi... ect).. my hast has limited traffic .. so i need to control the downloaded files to use a part of the...
9
by: jgcrawford | last post by:
G'day, I'm writing a ringtone manager for nokia ringtones and I'd like to be able to play the ringtone on the PC speaker. I've had some success in DOS with turbo C and its sound(), delay() and...
10
by: Rick Anderson | last post by:
All, I am receiving the following compilation error on LINUX (but not Solaris, HPUX, WIN32, etc): compiling osr.c LBFO.h(369): warning #64: declaration does not declare anything extern...
7
by: Smartbomb | last post by:
Hey guys and gals, I was wondering how I could do a bandwidth traffice moniter on incoming and outgoing traffic on a network card. is there a simple way to moniter and record the traffic? I know of...
14
by: Johan Christensson | last post by:
Hi. I got contacted by an old teacher today that works at a public shool here in Sweden. They have a ever groving problem with the students playing Counter Strike on the schools computers. Not...
3
by: mostafijur | last post by:
Hi, I need Source code in C/C++ to capture packets from a LAN using Linux (Mandriva) OS.Packets are like TCP,UDP,HTTP. Thanks
1
by: rada.lambretha | last post by:
Configuring Linux as a Firewall * Making installation choices * Introducing iptables * Using iptables commands * Simplifying things with firewall GUIs * Adding proxy functionality As...
13
by: Adhal | last post by:
Hi, How can I stop hotlinking to a specific file, and I want it to redirect it to a PHP link so I can monitor the number of downloads. Here is my site with the download page:...
7
by: r0g | last post by:
I'd like PHP to send mail to a local mailserver running at localhost:25 like I used to on windows. This mailserver is a dummy server which just writes the mail to disk for unit testing and works...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.