How do you dispose a tracelistener properly?

后端 未结 1 1947
没有蜡笔的小新
没有蜡笔的小新 2021-01-25 12:15

I\'ve actually written a tracelistener component that logs to a networkstream. The code for that is here:

using Newtonsoft.Json.Linq;
using System;
using System.         


        
相关标签:
1条回答
  • 2021-01-25 12:51

    Apparently ProcessExit event works. :(

            AppDomain.CurrentDomain.ProcessExit += (s, e) =>
            {
                SendCommand("QUIT", "closing connection");
                _reader.ReadLine();
                //TODO : verify the response code received
                client.Close();
            };
    
    0 讨论(0)
提交回复
热议问题