Set each new connection to get a random colour.
Moved socket connection into its own function.