Hi,
I want to get send/receive of my PC NICs in Linux?! For windows I can use "GetIfTable" and process the output. And about linux?! UI have to install some software ?!
Thanks everyone
Hi,
I want to get send/receive of my PC NICs in Linux?! For windows I can use "GetIfTable" and process the output. And about linux?! UI have to install some software ?!
Thanks everyone
Translating. . .
Easy, at the command prompt type:Originally Posted by hosseinyounesiIn windows you can do about the same thing from the cmd prompt (Start->run-> Then type cmd and click okay)Code:ifconfigIf this ain't wha'jer lookin fer, I ain't got no clue.Code:ipconfig /all
Thanks,
I have to use a program to do that!!! What is "ifstat" ?!
EDIT: What do you mean you have to use a program to do that???? ifconfig IS a program.
I dug this out of the vault.Code:fd = socket(AF_INET, SOCK_DGRAM, 0); strcpy(ifr.ifr_name, devname); ifr.ifr_addr.sa_family = AF_INET; ioctl(fd, SIOCGIFADDR, &ifr); sin = (struct sockaddr_in *) &ifr.ifr_addr;
You'll have to figure it out from there.
Thanks,
I mean that I have to write a software and I need to get nic traffic!!! Clear?
But what the code you've written is ?!!!!
Why not ask man?
No. Do you need to actually talk to the nic yourself, or are you just interested in using the network? (Maybe I'm just out of the loop, but I don't associate "traffic" with "writing a driver to talk to a piece of hardware".)
I need the send/receive of each interfaces
Your English is not that good, or you just don't know how to express yourself. The bottom line is it is NOT clear what you are asking for.
If you need to get all network packets, you don't have to write software to do that. It is available in the Linux kernel. You'll have to configure network packet filter (iptables) and write rules that log all network traffic on each network interface.
If you are attempting to tell us that you have some project for school, then at least let us know what your requirements are. Just saying "I need send/receive of each interfaces" is NOT enough information. I can send and receive from each interface with hundreds of tools, Firefox to name one.
What are your requirements and what is your goal? Though English may not be your native language, you could always give us a 1000 word dissertation on the subject (a picture is worth a thousand words).
Thanks, But I think that you don't understand my question! I said that I've used "GetIfTable" to collect information in windows. I introduced ifstat, ...
By the way, Excuse me if I didn't ask my question clearly
This is not homework I want to use it for my software! I want to collect the send/receive of my COMPUTER (all interfaces) such as what we can see by right clicking on the connection icon in the taskbar of Windows XP I could do this by "GetIfTable" in windows. My question is that how can I do this in Linux? CLEAR? (Tell me If any of sentences is not right)
Thanks again
So what's wrong with ifconfig, which was suggested in post #2?
I believe RX is short for "received" and TX is short for "transmitted".Code:eth0 Link encap:Ethernet HWaddr 00:E0:4D:89:B5:73 inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:5792 errors:0 dropped:0 overruns:0 frame:0 TX packets:6309 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:4451227 (4.2 MiB) TX bytes:1435602 (1.3 MiB) Interrupt:23 Base address:0x8000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:354 errors:0 dropped:0 overruns:0 frame:0 TX packets:354 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:180029 (175.8 KiB) TX bytes:180029 (175.8 KiB)
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
yes, but isn't there any function or library that can be used in C or C++ ?!
I think pcap() will provide you with that info too, but really I look at that and see that it will take about 10 lines of code to parse, so why bother using a library?
There are probably a cazillion little GUI apps around for this stuff, eg, it is one thing that the incredibly awesome gkrellm covers, if you learn to use one of those new "search engines" everyone talks about, such as "google.com" you might find something...
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
So I went here, clicked on section 3 of the manual which is where the library functions are, then scrolled down to I and looked for things that started with if. Some of them look like what you want.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
I know what is "google" !!!!!! I hope that you are joking I just thought that maybe someone has did this before
I will report my attempt here about libpcap and ifstat or ...
Thanks again