Page 1 of 1

Problem with ACK response

Posted: Mon Apr 09, 2012 6:51 pm
by miguito
When I receive the message ORM, return an ACK (TCP Indy). Sending a batch of messages (ten) done correctly the first 5 and the sixth broke my connection (Connection Closed Gracefully).

Can it be to have trial components installed yet?

I post the code is the event of idTCPServer OnExecute.

Code: Select all

procedure TForm4.IdTCPServer1Execute(AContext: TIdContext);
var
  Bloques: integer;
  i: integer;
  TamanoBloque: integer;
  trozoTexto: ansistring;
  texto: ansistring;
  ack: TdiACK_25;
begin

  TamanoBloque := 1024;

  // Receive
  Bloques := StrToInt(AContext.Connection.IOHandler.ReadLn);
  texto := '';
  for i := 0 to Bloques do
    texto := texto + AContext.Connection.IOHandler.ReadLn;
  texto := MimeDecodeString(texto);
  //Result := texto;
  memo1.lines.add(texto);

  // Send
  ack := TdiACK_25.Create;
  try
    ////////////////////////////
    texto := ack.AsXML;    // I GET ERROR HERE (with "ack.AsString" Too)
    ////////////////////////////
    texto := MimeEncodeStringNoCRLF(texto);
    Bloques := Length(texto) div TamanoBloque;
    AContext.Connection.IOHandler.writeln(IntToStr(Bloques));
    for i := 0 to Bloques do
    begin
      trozoTexto := ansistrings.AnsiMidStr(texto, (TamanoBloque * i) + 1, TamanoBloque);
      AContext.Connection.IOHandler.writeln(trozoTexto);
    end;
  finally
    freeandnil(ack);
  end;
end;
A greeting

Re: Problem with ACK response

Posted: Mon Apr 09, 2012 7:13 pm
by admin
Hi,
Trial version is a limited 10 message per day.
Exception message is : 'Trial limit has been reached.'
What is your exception message ?

Best regards.

Re: Problem with ACK response

Posted: Mon Apr 09, 2012 7:44 pm
by miguito
I had hidden the exceptions of Delphi (Notity on language exceptions)
and see "Connection Closed Gracefully." But is caused
by "Trial Has Been limit reached".

Ok. Thanks