Add VC++ build-ability, thread deletion fix, socket type change.