Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Feb : Re: Reply Code is not valid

www.cryer.info
Managed Newsgroup Archive

Re: Reply Code is not valid

Subject:Re: Reply Code is not valid
Posted by:"Kendrick" (kkendri..@harbornet.com)
Date:Tue, 12 Feb 2008 15:57:53

> How were you sending the response to begin with?

procedure TfmMain.SendClientMessage
       (var aMsg: TMessage; const aStr: string = '';
        const showTime: boolean = False; const log: boolean = True);
var cncts: TList; p:integer; s: string;
begin
  cncts := FMyServer.Contexts.LockList;
  try
    for p := 0 to cncts.Count - 1 do
    begin
      if TIdContext(cncts[p]).Connection.Socket.Binding.Handle
         = aMsg.WParam then {wParam has the client handle}
      try
          s:= IntToStr(aMsg.WParam) + ': ' + aStr;
          if showTime then s:= s + ':' + TimeToStr(Now); // this is the line
I changed. It was s:=  TimeToStr(Now) + ': ' + s;
          TIdContext(cncts[p]).Connection.IOHandler.WriteLn(s);
          if log then begin  //then I added this after Writeln to format
(easier to read) for logging...
            s:= aStr;
            if showTime then s:= TimeToStr(Now)+ ':' + s ;
            s:= s +  ' (' + IntToStr(aMsg.WParam) + ')';
            mLog.Lines.Insert(0,s);
          end;
          Break;
      except
        s:= 'Error in message send to Client: ';
        PostDBugMessage(Integer(aMsg.WParam), s);
      end;
    end;
  finally
    FMyServer.Contexts.UnlockList;
  end;
end;

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive