New topic: 

Updating Sessions from a socket?

<http://forums.realsoftware.com/viewtopic.php?t=47011>

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        Zack.H          Post subject: Updating Sessions from a 
socket?Posted: Wed Feb 20, 2013 11:05 pm                         
Joined: Sun Jun 15, 2008 1:50 am
Posts: 63                So I'm iterating through all the sessions in the 
application from a client socket which I've created,
and I'm trying to update data on the screen for each session currently active.

It doesn't seem to be working at all but if I do it in a form/button control it 
works fine it updates for every open session,
as far as I can see it doesn't return nil when I check if the form I'm trying 
to update is active.

It just doesn't do anything, Any ideas? Code is below.

Dim LogFile As FolderItem = GetFolderItem("CMPLog")
Dim Log As TextOutputStream
Dim DataIn As String = me.ReadAll
if( LogFile.Exists = False) Then
  Log = Log.Create(LogFile)
else
  Log = Log.Append(LogFile)
end

Log.WriteLine(DataIn)

If( Datain.InStr("SUCCESS") > 0 ) Then
  Dim dbFile as FolderItem
  Dim db as RealSQLDatabase
  db=New RealSQLdatabase
  dbFile = GetFolderItem("database.rsd")
  db.DatabaseFile=dbFile
  
  if db.connect() then
  
  db.SQLExecute("UPDATE manager SET status='Deployed' WHERE 
name='"+self.manager+"'")
  
  if(db.error = false) then
  
  db.commit
  
  Log.WriteLine("Updating: "+self.manager)
  
  For b as integer = 0 to app.sessioncount - 1
    dim s as session = app.sessionAtIndex(b)
    if s.MainPanel.Manager <> Nil Then
    s.MainPanel.Manager.ReloadLists()
    s.MainPanel.Manager.ListBox1.AddRow("Test")
    else
    Log.WriteLine("Session MainPanel.Manager was NIL!")
    end
  next
  
  else
  
  db.rollback
  Log.WriteLine("There was an issue updating the status " + db.ErrorMessage )
  Log.Close()
  
  end
  
  else
  Log.WriteLine("Couldn't connect to the DB while trying to update the mailing 
status")
  Log.Close()
  end
  
End


Also just to note when I close/re-open the form it re-runs the method 
ReloadLists() and that does work properly and updates from the database as I've 
specified with the "status" field.

It's just when that method is called from the socket it doesn't seem to work, I 
also call it when the user is in a different form saving data to this form and 
it works there as well.   
                             Top                Zack.H          Post subject: 
Re: Updating Sessions from a socket?Posted: Wed Feb 20, 2013 11:24 pm           
              
Joined: Sun Jun 15, 2008 1:50 am
Posts: 63                I've decided to further testing and upon doing such I 
added some code and it seems my sessions aren't being iterated completely
For b as integer = 0 to app.sessioncount - 1
  dim s as session = app.sessionAtIndex(b)
  Log.WriteLine("Updating Session: " + str(b))
  if s.MainPanel.MailingManager <> Nil Then
  s.MainPanel.MailingManager.ReloadLists()
  else
  Log.WriteLine("Session MainPanel.MailingManager was NIL!")
  end
next


I tested this with two windows open and only the following was logged:
Updating Session: 0
Updating: test45
Updating Session: 0
Updating: test45
Updating Session: 0


Where as there should've been two separate sessions open...
Any idea why attempting to access app.sessioncount from a client socket isn't 
returning the appropriate data?   
                             Top                taylor-design          Post 
subject: Re: Updating Sessions from a socket?Posted: Thu Feb 21, 2013 2:10 am   
                      
Joined: Wed Mar 22, 2006 11:15 am
Posts: 575
Location: Southern California                * What do you get for your session 
count test with 3 or 4 sessions open?

* What happens if you setup the WebSessionContext before calling 
s.MainPanel.MailingManager.ReloadLists()?      
_________________
Daniel L. Taylor
Custom Controls for Real Studio WE!
Visit: http://www.webcustomcontrols.com/  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to