TROBroadcastChannel: Async, and GetResponseByUID

Question 1: TROBroadcastChannel MUST call a server’s methods in asyn fashion, correct?

Question 2: ROBroadcastChannelBroadCastResponseReceived(aServerIP, aResponseUID: string);

How to use ResponseStorage.GetRespByUID(aResponseUID) to figure out which service method is returning the response?

Hi,

not yet. check the TimeServer sample - client calls server’s method in usual way.

check code in TROIndyUDPChannel.IntDispatch:

    lUID := GetNewMesgID;
    lResp := nil;
    SendReq(aRequest,lUID);
    repeat
      if ReceiveResp(IndyClient.ReceiveTimeout) then
      begin
        if FRespStorage.GetRespByUID(lUID) <> nil then
          lResp := FRespStorage.GetRespByUID(lUID).Response;
      end;
      inc(lRetry);
    until (lRetry > Retrys) or (lResp <> nil);

you can specify it by yourself or get it from aRequest and make conformity between lResp and service’s methods.

Thank you.

I realized that I can use IROMessage.ReadFromStream to parse TROResponseItem.Response, which itself is just a TStream.