Pull over good networking changes by @SpaceManiac

Credits to his Glowstone project

Signed-off-by: Chris Sanders <zidane@outlook.com>