unify TCP and UDP connection