Replace ping with socket connection