Improved socket wrapper. Added poll wrapper.