Make sure the socket isn't null before wasting time.