Remove unused waitForSocket function