private void HandleError(Exception e, SocketManager socket) { socket.Send("<file type='error'><msg>Server handling message raised exception: " + e.Message + "</msg></file"); Console.WriteLine("Recieced error: {0}\n{1}\n...while handling message. Sent error back to sender.", e.Message, e.StackTrace); }
// begins accepting new messages asynchronously // will continue to accept new messages ad infinitum public void StartAsyncReceive(SocketManager socket) { socket.AsyncReceiveXml(endAsyncReceiveXml, HandleSocketDeath); }
// what to do when a socket dies protected abstract void HandleSocketDeath(SocketManager socket);