![]() |
| | #1 |
| Registered User Join Date: Jul 2009
Posts: 57
| 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 |
| hosseinyounesi is offline | |
| | #2 | |
| Jaxom's & Imriel's Dad Join Date: Aug 2006 Location: Alabama
Posts: 801
| Translating. . . Quote:
Code: ifconfig Code: ipconfig /all | |
| Kennedy is offline | |
| | #3 |
| Registered User Join Date: Jul 2009
Posts: 57
| Thanks, I have to use a program to do that!!! What is "ifstat" ?! |
| hosseinyounesi is offline | |
| | #4 |
| Jaxom's & Imriel's Dad Join Date: Aug 2006 Location: Alabama
Posts: 801
| EDIT: What do you mean you have to use a program to do that???? ifconfig IS a program. 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. |
| Kennedy is offline | |
| | #5 |
| Registered User Join Date: Jul 2009
Posts: 57
| 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 ?!!!! |
| hosseinyounesi is offline | |
| | #6 | |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| Quote:
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".) | |
| tabstop is offline | |
| | #7 |
| Registered User Join Date: Jul 2009
Posts: 57
| I need the send/receive of each interfaces |
| hosseinyounesi is offline | |
| | #8 |
| Jaxom's & Imriel's Dad Join Date: Aug 2006 Location: Alabama
Posts: 801
| 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). |
| Kennedy is offline | |
| | #9 |
| Registered User Join Date: Jul 2009
Posts: 57
| 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 |
| hosseinyounesi is offline | |
| | #10 |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| So what's wrong with ifconfig, which was suggested in post #2? 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)
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS |
| MK27 is offline | |
| | #11 |
| Registered User Join Date: Jul 2009
Posts: 57
| yes, but isn't there any function or library that can be used in C or C++ ?! |
| hosseinyounesi is offline | |
| | #12 | |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| Quote:
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...
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS | |
| MK27 is offline | |
| | #14 | |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| Quote:
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS | |
| MK27 is offline | |
| | #15 |
| Registered User Join Date: Jul 2009
Posts: 57
| 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 |
| hosseinyounesi is offline | |
![]() |
| Tags |
| card, interface, network, traffic |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bitwise Unwanted Output | pobri19 | C++ Programming | 4 | 09-15-2008 04:07 AM |
| Vector out of range program crash. | Shamino | C++ Programming | 11 | 01-18-2008 05:37 PM |
| Segmentation Fault - aaaaaaaah! | yogibear | C Programming | 6 | 10-01-2007 03:21 AM |
| Blackjack | Tommo | C Programming | 10 | 06-20-2007 08:07 PM |
| How can I access a struct (from a header file)? | loxslay | C++ Programming | 3 | 10-07-2006 01:25 PM |