added code for connecting to tcp