In most network applications, managing incoming flow is an important thing, and is a quite hard thing to set up. In case your algorithm is too restrictive, you will drop too much connection, and in case it’s too permissive, you will accept undesired connections. The real need is to tell your application: « Accept N connection(s) in a X second(s) time range ».
Concept
The way you should decide if a connection have to be dropped or not is looking in an historic of X second(s) how many connection(s) from an IP have been performed, and then deducing the count. This is the « simple » algorithm that does that:
My initial problem
My previous ISP (Free) provided me with a nice triple-play ADSL set-top box (aka « Freebox »). It has an internal 40GB hard disk drive accessible using FTP and was able to play content streamed through UPnP. I recently switched to a new ISP (Numéricable) because they were offering FTTH (100mbits downstream, 5mbits upstream) in my place, but unfortunately they’re not offering any kind of set-top box. I just got a classic Netgear modem and Netgear DVB device, which is unable to play any video content from the network.
As it turns out, I’m missing the HTPC-kind functionalities a pretty damn lot. Playing my video content on my living room’s TV is important in my eyes. Sadly, my computer is too far from the TV to link both using an HMDI cable. That’s how I decided that I’ll be building an HTPC.
What’s an HTPC?
What is exactly an HTPC (Home Theater Personal Computer or Home Cinéma & Media Center in french):
Read the rest of this entry

