Changed int -> SOCKET where appropriate, per Ben Currie