Basic TCP and UDP implementation