Client.Disconnected event cann't be triggered?

Jun 6, 2010 at 4:49 AM

 I had debugged the example project but I found the Client_Disconnected function did't be executed!

 static void listner_ClientAccepted(object sender, ClientAcceptedEventArgs e)
            Console.WriteLine("Client {0} Accepted",e.Client.HostName);
            e.Client.CommingDataAvailable += new EventHandler<CommingDataAvailableEventArgs>(Client_CommingDataAvailable);
            e.Client.Disconnected += new EventHandler<EventArgs>(Client_Disconnected);

        static void Client_Disconnected(object sender, EventArgs e)
            Console.WriteLine("Client {0} Disconnected", (sender as TcpClientService).HostName);
            clients.Remove(sender as TcpClientService);

Jun 6, 2010 at 8:44 AM

well , the implementation of Client Disconnected Event is somehow Silly , Cause there is nothing to let you know in the Original Microsoft TCP Classes , That the Client is Disconnected . So this Event is Fired when and Only When any Attempt to Send or Receive Data between the two End Points fails  , Cause this Event is Fired when Any Socket Exception thrown while trying to send or receive data...

and you can consider this Event Unreliable ...

Hope now it's Clear ...

Thank you for participating  :)

Oct 17, 2011 at 9:22 AM

Please help some code to disconnect