Info about thread

Hi!

Sorry I don t have source code now… I have buyed license but I don t have source code… so there is an callback example?

All our licenses come will full library source code, though…

Where Can i download It?

It should be part of the regular product install.

I have installed trial before to buy It… So how to upgrade?

Hi…

Ok i have seen this example

But It is client to server call back and It doesn t solve my problem… I Need to have if possibile to have server to client call back… I Need to know if client have received server request… How Can i do?

Ok You write me
if event isn’t delivered, it will be put to queue again.

It s automatically? Or i Need to implement It?
It works Only with Olympia session or Also with Memory session?

You need to install full version. you can download it form your personal cabinet ( http://my.remobjects.com )


IROValidatedSessionsChangesListener interface

  IROValidatedSessionsChangesListener = interface
    ['{BE226A1C-DA1A-45E3-9C85-C6C79BAADF5A}']
    procedure EventSucceeded(aClientID, aId: TGUID);
  end;

the EventSucceeded method will be called when event was successfully delivered to client.
aId this is ID of event.
it can be unusable for you because this ID is assigned internally after you have created event


it’s automatically for all events and EventRepositories and you don’t need to implement it
ofc, this is suitable for SuperTCP server only

Ok i have last problem…
Server
My server app send many data to client each 1 second with eventsink
Client
I create ro object in runtime

      ROChannel:= TROSuperTCPChannel.create(self);
      rochannel.AckWaitTimeout := 20000;
      rochannel.ConnectionWaitTimeout := 10000;
      rochannel.ConnectTimeout := 10000;
      rochannel.Port := SuperTcpPort;
      rochannel.Host := SuperTcpHost;
      rochannel.SynchronizeEvents := true;
      rochannel.OnException := ROChannelException;
      rochannel.OnDisconnected := ROChannelDisconnected;
      ROMessage:= TROBinMessage.Create;
      ROMessage.UseCompression := true;
      Romessage.MinSizeForCompression := 256;
      Romessage.AddServerExceptionPrefix := false;
      RORemoteService:= TRORemoteService.Create(self);
      RORemoteService.Channel := RoChannel;
      RORemoteService.Message := RoMessage;
      RORemoteService.ServiceName := 'MulticastService';
      EventReceiver:= TROEventReceiver.Create(self);
      EventReceiver.Channel := ROChannel;
      EventReceiver.Message := RoMessage;
      EventReceiver.ServiceName := 'MulticastService';
      EventReceiver.Interval := 5000;
      EventReceiver.MaximumMessagesPerPoll := 5000;
      EventReceiver.RegisterEventHandlers([EID_MulticastTestEvent], [Self]);
      EventReceiver.Active := True;

And when close app i use

if assigned(EventReceiver) then
   begin
//    ShutdownServer;
//    sleep(2000);
    EventReceiver.Active := False;
    EventReceiver.UnregisterEventHandlers([EID_MulticastTestEvent]);
   end;

   if assigned(ROchannel) then
   begin
   // rochannel.Client.DisconnectNotifyPeer;
    ROchannel.Active := false;
    if assigned(rochannel) then
     if assigned(rochannel.Client) then
      if assigned(rochannel.Client.IOHandler) then
       begin
        rochannel.Client.IOHandler.InputBuffer.Clear;
        rochannel.Client.IOHandler.CloseGracefully;
        rochannel.Client.Disconnect;
       end;
    rochannel.DisposeOf;
   end;

  if assigned(EventReceiver) then
   begin
   EventReceiver.Active := false;
    EventReceiver.free;
    EventReceiver:=nil;
   end;
  if assigned(ROMessage) then
   begin

    ROMessage.free;
    ROMessage:=nil;
   end;
  if assigned(RORemoteService) then
   begin

    RORemoteService.free;
    RORemoteService:=nil;
   end;
     inherited Destroy ;

But when close app It gang

It seem that doesn t close threads so how close It?

you call directly indy methods. it can be a reason for such failure because RO code knows nothing about such calls and some code is still executed in background thread.

try to close/destroy rochannel after destroying other things like EventReceiver, RORemoteService, ROMessage

Indy method is a test because rochannel.free fail…
When use rochannel.free hang. After some times i got max thread error. I have 2 client connection in same app. It hang at First connection so second connection riceived data. So It possibile force to disconnect client from client app?

can you create a simple testcase, that reproduces this behavior, pls?
you can attach it here or drop email to support@

It diffult task because Ro is inside a component… When destroy component hang. There is a test case where client and server synch a list or record from client to server?

We have no such example, but it can be a simple testcase with 2 methods: GetRecordList and UpdateRecordList

But with rochannel.active := false doesn t disconnect from server?

it should. Active := False; calls TROBaseSuperChannel.SetInactive. it performs some finalization steps.
Looks like, in your case, background thread isn’t finished by some reasons. Why it doesn’t - your testcase could give a light to this problem.

click client1 and client2
wait some time

After close x in client… many times give an error…many times hangs…sometimes works…
same thing with server…

Start Server
Start Client
click client1 and client2
wait some time

After close x in server… many times give an error…many times hangs…sometimes works…

example can have some errors but I need to close client and server… same thing happen in my apps.

test.rar (5.9 MB)

sorry missing firs 2 paragraphs…

It Hang with trobasesuperchannel.SetInactive.

I have do a small project that simulate my app…

SOLUTION:

I have lost many days to understand problem to shutdown Server and clients. It always hang.
Problem is:
Server.active := false; and
Client.active := false;

My application hang or crash always…
I use superTcpchannel(Indy Version).

So I have changed from supertcpserver and supertcpchannel to Synapse and works fine… I never had crash or hangs until now.

So please fix Supertcp channel indy version or remove component because doesn t works.
So I have lost days for nothing… Problem with indy (checked in your forum) is started from version 6. and never fixed…

ok server works but client hang again also if I have Synapse… Have you check my test app?