0 is a possible socket, let's return -1 for errors instead