473,661 Members | 2,456 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3395
In article <11************ **********@g10g 2000cwb.googleg roups.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.programmin g.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************ **********@u72g 2000cwu.googleg roups.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.progr ammer.

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

--
Keith Thompson (The_Other_Keit h) 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.c om, 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/googlegroupsrep ly/>
Jun 1 '06 #6

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

Similar topics

2
1974
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 traffic .. then disable the downloading when the traffic for downlading this files to some point (lets say 3GB).. all the files are in one directory (folder).. is there any php program
9
8429
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 nosound(). Is there anything similar for Linux? I know I can make a simple beep with '\a', but that's not what I need. If not, can someone please show me how to do this with the /dev/audio device?
10
3509
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 struct foobar; ^
7
10013
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 performance counter but did not get it working. Thanks for the help in advance. -Smartbomb
14
1355
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 only dose this pose a problem with bandwidth usage, but the fact that the Half-Life installations often are not licensed, and this puts the school in a tight position. Apperently the schools IT department say that thay can't do anything to stop it...
3
3264
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
2609
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 Linux gains increasing acceptance in corporate datacenters and
13
2020
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: http://www.adhal.org/software/downloads.htm And here is softpedia directly connecting to my file and bypassing the counter php. http://www.softpedia.com/get/File-managers/HashNET.shtml
7
2624
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 fine when I use thunderbird to send mail to it and used to work fine under windows however... It doesn't work under Ubuntu. Looking at my php.ini file I see...
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8341
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8542
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8630
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1740
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.