counting the packets


 
Thread Tools Search this Thread
Special Forums IP Networking counting the packets
# 1  
Old 11-16-2006
counting the packets

there are a number of clients connected to a server.... how can i count that each clients recieve ...? how do i moniter the activity of the client..?
# 2  
Old 11-16-2006
Tcpdump , ethereal , not worthy ? Multithreaded aplication ? Smilie


If you wanna measure/count how many bytes does a client receive ( on the server side ) , you can easily implement a contor , for receive bytes.Suposing that all byte's receive by one client are send by the server , it's easy to make something like :

Code:
send(j,da,sizeof(da), 0);

Let's say da is the string passed to the client ( a client J ).You incremenent a contor so measure how many bytes are transfered to the client.

Let's say I send 4 bytes to the client ( once ) and then 3 .. I can do this.

Code:
int j;
int TRAFIC=0; /* start 0 bytes transfered to client j */
nbytes=send(da,sizeof(da),0);
TRAFIC=TRAFIC+nbytes;

So if all trafic to a specified client , is send by the server to that client , you can easily count how many bytes , are received by the client J .


Hope it help !
# 3  
Old 11-17-2006
using C

i am planning to implement this in unix system and want to do this using C as that is the language that know well.... how doi start with it?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. IP Networking

Route packets over specified interface

Hi, I'm quite new to unix networking and ip tables. I'm running a debian (htpc) server with two NIC's; eth0 and wlan0. I'm trying to set it up in a way that eth0 is the default interface for internet, but some processes should run through wlan0. For example, I'm using eth0 for downloads... (2 Replies)
Discussion started by: Subbeh
2 Replies

2. Solaris

multitude of packets from 127.0.0.1

I was checking routing table, and noticed that our server has a lot packets from localhost: Routing Table: IPv4 Destination Gateway Flags Ref Use Interface -------------------- -------------------- ----- ----- ------ --------- .. 127.0.0.1 127.0.0.1 ... (1 Reply)
Discussion started by: orange47
1 Replies

3. Infrastructure Monitoring

Accept SNMP Packets...

hi guys I've configured snmp on some linux snmpd.conf rocommunity com_read x.x.x.10 rwcommunity com_write x.x.x.10 Now one of my coworkers asked to do the same that he does on windows for my linux.... But I have no idea how to configure that basically when SNMP is configure there... (5 Replies)
Discussion started by: karlochacon
5 Replies

4. HP-UX

packets statistics

Hi there, are there any functions that can get the packets statistics on UNIX ? thanks. (2 Replies)
Discussion started by: Frank2004
2 Replies

5. Shell Programming and Scripting

send packets

Hello I need to send some packets to check connection. Packets will be catch by snoop. Is there any Sun tool to send some packets on selected IP and Port? Thx (1 Reply)
Discussion started by: miojamo
1 Replies

6. UNIX for Advanced & Expert Users

ethernet packets counting

salutation experts, I want to counting arrival and outgoing packets in a specific interval (ethernet interface), what library or method you offer me that i can use it in c lang? tnx (1 Reply)
Discussion started by: galaxy.ice
1 Replies

7. UNIX for Dummies Questions & Answers

Dumping network packets

Hi, My Solaris Workstation has got 4 NICS, out of which one of them(bge3) is unplugged from the rest of the external network & connected to other interface(bge1). The isolated NIC serves as a simulated Ethernet Interface for my application under development. Now, I'd like to capture RAW... (1 Reply)
Discussion started by: smanu
1 Replies

8. Programming

Packets Getting Lost

I am working on a project, which has the following type of hardware setup. A special hardware device is receiving data from an external network interface. So we can have multiple such a hardware devices. Now these hardware devices will route the captured incoming data through the external... (4 Replies)
Discussion started by: S.P.Prasad
4 Replies

9. IP Networking

Redirecting outgoing packets

I'd like to find out how to redirect Outbound packets. So instead of having packets go to IP1 as they normally would, have them go to IP2 instead. I believe this is possible using IPFW but I'm not sure. I've played with it, but haven't gotten too far. Any ideas would be appreciated. (1 Reply)
Discussion started by: Seraph
1 Replies

10. UNIX for Dummies Questions & Answers

sending packets

How can i send a packet, and what is an empty packet? (8 Replies)
Discussion started by: Avatar0fEvil
8 Replies
Login or Register to Ask a Question