// Called when we receive a connection from a client public void OnConnection(IAsyncResult res) { Socket client = null; try { client = m_listener.EndAccept(res); _logger.Log("Policy server accepted connection."); } catch (SocketException) { return; } // handle this policy request with a PolicyConnection var pc = new PolicyConnection(client, m_policy, _logger); // look for more connections m_listener.BeginAccept(new AsyncCallback(OnConnection), null); }
// Called when we receive a connection from a client public void OnConnection(IAsyncResult res) { Console.WriteLine("Got connection"); Socket client = null; try { client = m_listener.EndAccept(res); } catch (SocketException) { return; } // handle this policy request with a PolicyConnection PolicyConnection pc = new PolicyConnection(client, m_policy); // look for more connections m_listener.BeginAccept(new AsyncCallback(OnConnection), null); }