Jump to content

docjones

uniGUI Subscriber
  • Posts

    117
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by docjones

  1. thanks for your quick answer, solved. but a question, why if i put port=xxxx property on overloaded constructor uniservermodule.create(..), then miss port asigned value in ServerModuleBeforeinit(..). ?, it's a bug?. thanks again. Constructor TUniserverModule.Create(Aowner:Tcomponent;DefaultPort:Integer); Begin Fport:=DefaultPort; port:=Fport; //first asignment. writeln('Tuniservermodule.Create() Port='+inttostr(port)); inherited create(Aowner); End; procedure TUniServerModule.UniGUIServerModuleBeforeInit(Sender: TObject); begin Writeln('Tuniservermodule.BeforeInit() Port='+inttostr(port)); if port<>FPort then begin Writeln('Detected diferent port than assigned oncreate(), Port='+inttostr(port)); port:=FPort; //asigned again. end; end;
  2. Hi I'm trying to create a unigui console standalone application, and it's working fine , no tray icon, and not vcl form interface. (perhaps this is not the best way to create console ungui application but is the only that occurred to me). But have a problem, if i try to change the server port, uniservermodule.port:=xxxx , or server.port, it's not working, always is running on port 8077. I tried to overload uniservermodule constructor, and passing port on constructor Tuniguiservermodule.create(application,port), but same problem, always running on port 8077. How can i do to run on diferent port ?. I attach a example. thanks. console01.zip
  3. you can do with fastreport, or quickreport. simply generate report to pdf/excel/html etc, and load into urlframe see this. http://forums.unigui.com/index.php?/topic/1564-fastreport-on-standalone-server/page__p__6190__hl__fastreport__fromsearch__1#entry6190 http://forums.unigui.com/index.php?/topic/1039-quickreport/page__st__20__p__3107__hl__fastreport__fromsearch__1#entry3107
  4. console application option may be interesting on wizard (Console Standalone Server) , perhaps it's no requiered mayor changes, only no tray icon, and no vcl main form show.
  5. i'm interested in how you do this . you saved session login information on bd, but, how do you detect in second module that user is not logged in ?, using cookies ? user ip ?, passing to second module parameters like sessionid and cheking bd?. thanks.
  6. Thanks, this is exactly i want to do. now, if too users are connected to primary server, my unigui app can control user sessions and redirect to another host . and i can do the same on the secondary server.
  7. Hi all. first, sorry for my poor english I'm playing with unigui, and i'm trying to balance user sessions into two unigui applications (hosted on same or diferent server). when user connect to primay server (localhost:8077), and sessions count >n , then i want terminate the user session, and redirect to second server like (localhost:8088). this is the code. Mainmodule. type TUniMainModule = class(TUniGUIMainModule) procedure UniGUIMainModuleCreate(Sender: TObject); procedure UniGUIMainModuleDestroy(Sender: TObject); private { Private declarations } public { Public declarations } Intime:tdatetime; Session:TUniGuiSession; Redirect:boolean; end; implementation {$R *.dfm} uses UniGUIVars, ServerModule; //when session starts. procedure TUniMainModule.UniGUIMainModuleCreate(Sender: TObject); begin Intime:=now; Session:=UniSession; Redirect:=false; UniServerModule.newsession(Self); end; //when session end. procedure TUniMainModule.UniGUIMainModuleDestroy(Sender: TObject); begin UniServerModule.EndSession(Self) end; ServerModule TUniServerModule = class(TUniGUIServerModule) private { Private declarations } procedure KillSession; protected procedure FirstInit; override; public { Public declarations } sessioncount:integer; procedure NewSession(MModule: TUniMainModule); procedure EndSession(MModule: TUniMainModule); end; implementation {$R *.dfm} uses UniGUIVars; Procedure Uni_Redirect(Sesion:TUniGUISession;Url:string); var Cad:string; Begin Cad:='location.href='''+url+''''; Sesion.AddJS(Cad); End; procedure TUniServerModule.NewSession(MModule: TUniMainModule); Begin //add session count. inc(sessioncount); if sessioncount>2 then begin //if > max allowed, then redirect. MModule.Redirect:=true; Uni_Redirect(Mmodule.Session,'http://localhost:8088'); end; End; procedure TUniServerModule.EndSession(MModule: TUniMainModule); Begin Dec(sessioncount); End; If i do a redirect (uni_redirect) on new session, then url redirect is not working and, if i try to redirect on mainform.create , then redirect is working, but can't terminate the session procedure TMainForm.UniFormCreate(Sender: TObject); begin if UniMainModule.Redirect then begin Uni_Redirect(UniSession,'http://localhost:8088'); //Unisession.UniApplication.Terminate;// can't do this, becouse not redirected. end; end; Then, how can i do redirect, and terminate session ? or this is not possible ? Thanx
×
×
  • Create New...