Im with ya on that and its exactly what im doing now.

Ok, well at least that answers my question. I will turn my attention to
other important aspects now.

 I do appreciate your help and time. You have a great weekend.



-----Original Message-----
From: Unmoderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Ryan Heath
Sent: Friday, May 13, 2005 4:39 PM
To: [email protected]
Subject: Re: [ADVANCED-DOTNET] creating dynamic ArrayLists per client

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 DevelopMentorR  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor�  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to