CSharp: Improvements to sockets