private void client_ErrorReceived(object sender, NetSockErrorReceivedEventArgs e) { if (e.Exception.GetType() == typeof(System.Net.Sockets.SocketException)) { System.Net.Sockets.SocketException s = (System.Net.Sockets.SocketException)e.Exception; this.Log("Error: " + e.Function + " - " + s.SocketErrorCode.ToString() + "\r\n" + s.ToString()); } else { this.Log("Error: " + e.Function + "\r\n" + e.Exception.ToString()); } }