LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-30-2009, 03:49 PM   #1
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,052

Rep: Reputation: 70
Is there any way I could do this...


I would like to be able to modify the tcpdump binary and add one small option.

I would like to be able to run a command once the activity stops for more than 5 secs.

For example, I'm transfering a file on a specific port, I want tcpdump to monitor the file transfer activity but once it stops, I would like the option to run a command or play a sound so that I know my download is complete. I know I could use firefox or a browser, but I've been experimenting with netcat and would like to learn more about tcp/ip. So I'm transfering files on netcat, monitoring the activity on the command

sudo tcpdump -i ath0 dst port 6666

So I see all the packets been sent, but I would like to know when the download is complete(since netcat doesn't give any notice when the file has been fully downloaded) by letting me play a sound or basically running a command once there is more than 5 secs of inactivity on tcpdump -i ath0 dst port 6666

How would I go about doing this? I'm not an experienced programmer but I love learning and exploring. Thanks.

Last edited by trist007; 01-30-2009 at 03:50 PM.
 
Old 01-31-2009, 05:01 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
How about using 'pv' as in 'nc IP_address port | pv -b > /some/file' instead?
 
Old 01-31-2009, 05:48 AM   #3
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 179Reputation: 179
In capitalism, man exploits man. In Communism, it's the other way around:
Code:
nc IP_address port | pv -b > /some/file
No, it would be more like:
Code:
pv -b 2> /some/file | nc IP_address port
See the pv man page for more information.
 
Old 01-31-2009, 11:54 AM   #4
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,052

Original Poster
Rep: Reputation: 70
Dood that's awesome, thanks guys.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration