|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
MSDN Using Asynchronous Server Socket ?Here try { listener.Bind(localEndPoint); listener.Listen(100); while (true) { // Set the event to nonsignaled state. allDone.Reset(); // Start an asynchronous socket to listen for connections. Console.WriteLine("Waiting for a connection..."); listener.BeginAccept( new AsyncCallback(AcceptCallback),listener ); // Wait until a connection is made before continuing. allDone.WaitOne(); } Why we use ManualResetEvent allDone = new ManualResetEvent(false); and call allDone.Reset() every time. and why not we use AutoResetEvent instead of ManualResetEvent. So not call Reset method every time. Any Reason ?. Because when i use this code in my real application as a window service, after some time (1 day or more) it reject to accept new sockets but service still running. This service installed on 20 machines which is connected via modem. But the problem occured on one or two machines. Please help me urgently. Zeeshan Gulzar |
|||||||||||||||||||||||