Started socket connection logic