I'm developing a system in C# for communication with a server (custom protocol over Sockets).
Without going into much detail about the context, I have two classes - ServerConnection and ServerMessage. The ServerConnection objects are capable of creating ServerMessage objects, which encapsulate information about the status of a reply.
However, ServerConnection is the class that handles all the data sending/receiving, and then sets the the relevant ServerMessage's properties asynchronously (all messages are held in an internal list until the relevant reply is received, whereupon it is edited and removed).
As ServerConnection needs to fiddle around with the internal workings of the ServerMessage (at the moment, I need it to be able to trigger a ManualResetEvent), it needs more access to that class than I want other classes to have.
I believe that Nested classes give access in a similar way, but I've so far failed to create the desired hierarchy.
*Clarification: I want ServerConnection to be the programmer's interface, and to provide information on operations through the use of ServerMessages.
Any ideas?