Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 07-18-2018, 05:13 AM   #1
LQ Newbie
Registered: Jul 2018
Location: Belgium
Distribution: Debian, Ubuntu
Posts: 2

Rep: Reputation: Disabled
Lightbulb Launch application when traffic detected on given port

Hello all,
I would like to trigger a given application (ffmpeg video encoder) when network traffic (streaming) is detected on a given port (for example: UDP/4001).
I don't mind if some packets are lost before the application is triggered.
I would also like to stop/kill the application when the traffic ends.
Does anyone know how this could be achieved?

My hints for the moment:
- Using port-knocking (knockd) but the devices that generates the traffic are hardware encoders so they cannot knock pre-defined ports before sending traffic. One solution could be to use the trigger sequence=4001:udp,4001:udp,4001:udp
- Monitor syslog (as fail2ban does) and detect iptables log on the given port

In both cases, my log files might get huge if all my UDP streaming traffic is logged.

Not easy as it seems... Any clue is welcome.

Old 07-18-2018, 07:44 AM   #2
Senior Member
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,838

Rep: Reputation: 1132Reputation: 1132Reputation: 1132Reputation: 1132Reputation: 1132Reputation: 1132Reputation: 1132Reputation: 1132Reputation: 1132
inetd is your friend.
Old 07-18-2018, 12:33 PM   #3
LQ Newbie
Registered: Jul 2018
Location: Belgium
Distribution: Debian, Ubuntu
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thank you for the quick reply. That is exactly what I was looking for.
Yet, I face a problem when xinetd triggers the ffmpeg encoder that tries to read traffic from the given UDP port (UDP/3000 in my case), ffmpeg cannot start and gives the following error:

[udp @ 0x1de60a0] bind failed: Address already in use
udp://localhost:3000: Input/output error

and indeed, when xinetd is running, the port 3000 appears in netstat:

# netstat -tuan | grep 3000
udp 0 0*

If I stop xinetd and launch my ffmpeg script manually, it works fine. Is that the normal behaviour of xinetd?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use VPN tunnel for all traffic except SMTP (port 25) traffic? maven12 Linux - Networking 2 11-09-2010 07:00 AM
Unable to launch application from workstation but able to launch from vnc chaitanya1982 Linux - Desktop 2 04-30-2010 04:52 AM
[HELP] redirect traffic to spesific port based on Traffic Content using iptables summersgone Linux - Server 2 06-22-2009 12:26 PM
How do you find an application using launch application pnoise Linux - Newbie 1 01-11-2009 11:44 PM
SNMP MRTG RRDTOOL Configu of CPU memory Disk Port data traffic doc traffic manish_2479 Linux - Networking 1 06-19-2007 08:08 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:03 PM.

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