refine tcp connection