Fix socket.cs to work with .NET Core