Updated socket API to be Windows XP compatible.