Info about thread


(bachirkallas .) #21

So is not possibile to have autoreconnect in thread? It must bene always in main thread?


(EvgenyK) #22

you can call usual Login in background thread, in this case, it will work as you want


(Alessandro) #23

Hi!

I don t have understand how to works RO SDK to implement new function with same example…

I have add Test Function under LoginService with in parameter(widestring).

so if I use codegen->Delphi and save it I lost all modifications about LoginService_Impl but if I use regenerate units from Rodl nothing happen… so how can I add new functions without delete source code?

Br,Alessandro


(EvgenyK) #24

You should not replace your _Impl with generated file by ServiceBuilder because ServiceBuilder always generates _Impl from scratch.
You need just copy methods declarations and replace it in existed _Impl. after this, you need update methods in implementation section.

the same can be reached via copying methods declarations from correspondent interface from _Intf and pasting it into _Impl


(Alessandro) #25

Hi!

I have some problem about sessions… I don t understand it…(supertcp channel sample). I have installed server app in server computer and client app in my computer. so I do login and I have sent message and it works. I have removed ethernet cable and replug it after 1 min. I have send a message but I have Session {…} could not be found… so after that connection is lost I need recreate session? How can I understand when session is Lost?
what about autoregistersession option?
Br,Alessandro


(EvgenyK) #26

on client-side, you can catch this case in Channel.OnLoginNeeded event that is fired when session isn’t found on server-side, like

procedure TSuperTCPChannelChat_ClientMainForm.ROChannelLoginNeeded(
  Sender: TROTransportChannel; anException: Exception; var aRetry: Boolean);
begin
  LogonButton.Click;    // code that performs login
  aRetry := Fconnected; // repeat if login was successful
end;

this AutoRegisterSession property is declared in documentation:

This property is used by the server to automatically sign new clients up to the event repository, to make it possible fo them to receive events without manual registration.


(Alessandro) #27

Hi!

Sorry to disturb you… I need to make application without sessions. It is peer to peer and I don t need store data or other web server solution…
I need to send data to server and after server take data from com send to back to client… It is simple… I m looking for first example… I understand how to implement data from client to server… but I can t understand how server send data to clients with eventsink. I have implemented back eventsink function but I don t understand how to implement it and how server can send data (which client can receive data?)
I need to start project but I m in trouble…
I have attached first project with back function in Rodl… can you help me to understand and implement eventsink?

Thank you very much
First.rar (1.9 MB)


(Alessandro) #28

Hi!

I found an example that works with sessions. Last problem that I have that eventsink now broadcast messages. I need that server send message to 1 client and not to all clients. I have used tguid but server notify always to all clients…

Can you help me?
multicastlib.rar (2.1 MB)


(EvgenyK) #29

Review TChatServerService.TalkPrivate in Super TCP Channel Chat sample.
this client can be set via adding it’s guid to SessionList of event

  ev.SessionList.Add(aDestGuid);

(bachirkallas .) #30

Ok last question for now…
1)Exist a Delphi example about async_ex? I Need handle call back…
2)When server is not connection and execute async_ex function. I got error in call back function or Only in async exception?
3)Can i know which function have error?i got more 1 function to do…
4)Can i use async_ex in eventsink function?(server side)


(EvgenyK) #31

the Phone Photo Server sample shows usage of _AsyncEx interfaces.

you get exception only inside your callback method:

      //lLoginEx: ILoginService_AsyncEx;
      try
        lLoginEx.EndLogin(aRequest);
      except
        on E: Exception do begin
          Message('','','exception in login callback:'+E.Message);
          raise;
        end;
      end;

_AsyncEx interfaces is client-side things. How did you want to use it on server-side?


(Alessandro) #32

How Can I know if client have received eventsink function from server?
For example I have data to send from server to client.
I send back data to client with eventsink
after I need to know if client have received data… so I can delete data from server…
otherwise I need to resend data…


(EvgenyK) #33

you can add a custom method in which client can inform server about received events so server can react to this info.


(Alessandro) #34

so is not possible know if it is eventsink is received or not?

I have very slow connection in your solution I need more bandwidth… so server send eventsink to client if client riceive it send a message to server that data is received…correct?

an other question about session…

after 15 min session expire… in ROInMemorySessionManager1SessionDeleted
I do Expired := false;

but I have always session expired…


(EvgenyK) #35

if event isn’t delivered, it will be put to queue again.
if event is delivered, it calls IROValidatedSessionsChangesListener.EventSucceeded.

see more at procedure TSendEvent.Callback(Caller: TROThreadPool; Thread: TThread); in uROBaseSuperTCPServer.pas

Note: Only TROOlympiaEventRepository supports this event, but you can create descendant of
TROInMemorySessionManager and implement it.


this event is called when session was already deleted.
Why you can’t just increase SessionDuration ?


(Alessandro) #36

I need that never expire it…is possible? (Only when use deleteSession)


(EvgenyK) #37

you can set SessionDuration to MaxInt minutes.
2147483647 minutes = ~ 4085 years
so it can be considered as never expired


(Alessandro) #38

You Speak About Client to Server?
I have this code in my Server:
ev := (serverform.ROInMemoryEventRepository1 as IMulticastTestEvent_Writer);
ev.ExcludeSender := False;
ev.SessionList.Add(guidtostring(localguid));

ev.NoticeData(localguid,tempdata);

from Server to Client…
so it send data but I don t know if Client have received data…
If It fails resend it? How?


(Alessandro) #39

procedure tengine.Senddata(tempdata :ArrayDatatoSend);
var
ev: IMulticastTestEvent_Writer;
begin
ev := (serverform.ROInMemoryEventRepository1 as IMulticastTestEvent_Writer);
ev.ExcludeSender := False;
ev.SessionList.Add(guidtostring(localguid));
try
ev.NoticeData(localguid,tempdata);

except
Serverform.Memo1.lines.add(‘Error’);
end;
end;

This is my code but never fire exception…


(EvgenyK) #40

Only OlympiaEventRepository supports IROValidatedSessionsChangesListener interface.
if you want to know that event is delivered, you need to create descendant of TROInMemoryEventRepository and implement this interface.

yes, it will resend it.
see except section inside TSendEvent.Callback (uROBaseSuperTCPServer.pas)