// handle a recieved message // returns a message to be sent // TODO: add consistency about if it returns/takes strings or XML // TODO: ...eh less imporant with handleSocket being the main interface here public virtual void HandleMessage(XmlDocument msg, SocketManager from) { string type = MessageTypeOf(msg); switch (type) { default: from.Send("<file type='error'><msg>Unexpect message type: " + type + "</msg></file>"); break; } }
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); }