I would highly recommend to read the link by irfansharif. It's probably the best primer ever written on the subject.