fix tcpsocket: may fail when first connection attempt did not succeed