The UNIX Forums
"Join the Network of UNIX System Users"


 
Subject: counting the packets
johno12345
Newbie
Rank: 1



UID 9
Digest Posts 0
Credits 0
Posts 25
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 6, 2007 09:13 AM  Profile | P.M. 
counting the packets



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..?


Top
iPod
Newbie
Rank: 1



UID 188
Digest Posts 0
Credits 0
Posts 15
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 6, 2007 09:13 AM  Profile | P.M. 
tcpdump , ethereal , not worthy ? multithreaded aplication ?  


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 .
Top
aaron_nimocks
Newbie
Rank: 1



UID 34
Digest Posts 0
Credits 0
Posts 5
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 6, 2007 09:13 AM  Profile | P.M. 
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?
Top
 

 

All times are GMT, the time now is Jan 8, 2009 05:09 PM

Powered by Discuz! 5.0.0  © 2001-2006 UNIX Forums
Processed in 0.028178 second(s), 6 queries

Clear Cookies - Contact Us - UNIX Help - Archiver - WAP