Stun guns are actually an electrical self-defense device that sends out an extremely high voltage (high shock) and low amperage electric shock to an attacker, causing extreme pain and discomfort. They work because they are designed to quickly and easily disorient and distract an attacker long enough for one to getaway. They work by sending out the extremely high voltage in a very quick burst, and their incredibly high frequency means that it can be felt from a far distance. The attacker is knocked down, confused, or even scared enough to let go.
Although this technology has been around for a long time, it hasn't really been developed into something portable until recently. Originally, stun guns were all done with the use of electrodes that were stuck directly onto the attacker's skin. These electrodes were connected to a control box that contained a charge controller. The power then would be turned on and it would take effect almost immediately upon contact. There was a very short amount of time in which the attacker would not feel a thing at all. However, this is obviously a much more serious issue than one might think. Electrodes could get quite messy and the problem of portability is a real one. That is why today's stun gun technology has evolved to where the actual weapon itself is completely portable and it doesn't even need to have an electrical discharge to work.