Establishing tcp connection