What you described in pseudo code is not directly possible...
You must keep a global (static) hashtable containing sessions.
Those sessions are retrievable by say the clients name
So each data processing must look up the session of the client before
it can do anything. This fact cannot be done easier.
Goes like this:
static Hashtable sessions = new Hashtable();
class Session
{
// containing whatever a client needs....
ArrayList Data1 = new ArrayList();
ArrayList DataTwo = new ArrayList();
}
private void login( string client)
{
Session newSession = new Session();
// store session in global sessions (should be locked)
session[client] = newSession;
}
private void logout( string client)
{
session.Remove(client);
}
Private void SetData1(string clientname, string data1)
{
// get clients session
Session session = sessions[clientname];
session.Data1.Add( data1);
}
Private void SetData2(string clientname, string data2)
{
// get clients session
Session session = sessions[clientname];
session.DataTwo.Add( data2);
}
I deliberately added logout, since the session will not automatically
dispose by it self, it must be removed from the sessions hashtable
explicitly.
HTH
// Ryan
===================================
This list is hosted by DevelopMentor� http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com