Jump to content

chmichael

Members
  • Content Count

    66
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by chmichael


  1. On 1/13/2025 at 11:46 PM, Remy Lebeau said:

    Is it really worth it? 

    1) It's better organized

    2) It's all in one place (code/issues/discussions)

     

    image.thumb.png.d96d8bc7cab19e065b24aaf8e86755d9.png

     

     

    Now if you don't want to enable it at least put a note that there is a "Indy delphipraxis forum" on the github so people don't open issues for questions.

    • Like 1

  2. On 9/24/2024 at 6:49 PM, Angus Robertson said:

    I've just tested the OverbyteIcsSslMailSnd sample in V9,3 and it's sending content and attached files as expected with the correct encoding headings. 

     

    But it is not attempting to send HTML emails.

     

    BTW, the component expects String content and will convert to whatever encoding is specified, no idea what will happen if you encode UTF8 and it then encodes it again. 

     

    Angus

     

     

    Angus

     

    I'll take a deeply look when i find some time


  3. Hello,

      Here's the function which i send the e-mails

     

    function SendEMail(const AArgs: TArray<String>): String;
    var
      FSMTP: TSSLSmtpCli;
    begin
      FSMTP := TSSLSmtpCli.Create(nil);
      FSMTP.SslContext := TSslContext.Create(nil);
      FSMTP.SslContext.SslMinVersion := sslVerTLS1_2;
    
      with FSMTP do
      begin
        Host := 'my.emailserver.com';
        Port := '587';
        Username := 'myuser@emailserver.com';
        Password := 'mypassword';
        AuthType := smtpAuthAutoSelect;
    
        ContentType := smtpHtml; // Important !!! Set it First
        //Allow8bitChars := False;
        //ConvertToCharset := True;
        CharSet := 'UTF-8';
    
        HdrFrom := 'myuser@emailserver.com';
        HdrTo := 'myuser@emailserver.com';
        RcptName.Text := HdrTo;
        HdrSubject := UTF8Encode(VarToStr(AArgs[0]));
    
        if Length(AArgs) > 1 then
          MailMessage.Text := UTF8Encode(VarToStr(AArgs[2]));
    
        OpenSync;
        MailSync;
    
        Result := ErrorMessage;
    
        FreeAndNil(FSMTP.SslContext);
        FreeAndNil(FSMTP);
      end;
    end;

     

    Using the v9.3 SVN version the e-mail which it sends adds an extra attachment which v9.1 didn't:  (either plaintext either html)

     

    image.png.a1a1d9d07cad137b39f144bb349cbeb9.png


  4. 8 hours ago, Angus Robertson said:

    I looked at MSQuic when it came out with a view to supporting it for ICS.  For Linux, MSQuic uses a forked OpenSSL version, but SChannel for Windows.  So MSQuic requires the latest Windows OS. 

    This isn't a problem in a year from now most will use Windows 11.

     

    8 hours ago, Angus Robertson said:

    To my knowledge, there are no functional benefits to HTTP/2 except performance with complex web applications with hundreds of elements on a page, and Delphi is not usually used for complex pages.

    Messaging protocols and middleware benefit also.

     

    8 hours ago, Angus Robertson said:

    I'd like to write a Delphi HTTP/2 implementation for ICS, but it really needs to be sponsored.  I can not justify the time myself, rather work on more useful projects.  

    Yes i know it's time consuming task but you can make sell it.

     

    atm only esegece has native delphi http/2 support as far i know.

    It would be nice to have a benchmark between esegece HTTP/2 vs ICS HTTP 1.1.

     


  5. 2 hours ago, Angus Robertson said:

    Most ICS functions are async, not blocking, you missed IpLogClient.onLogProgEvent := onCliLogProgEvent; from snippets, and in the event you check IpLogClient.States[0] for logstateOK or something else if failed. 

     

    As is often discussed here, it is rarely necessary or useful to use ICS components in a thread, but if so you can not use application.processmessages  since that is the main thread, you have to create the component within the thread Execute method, set the MultiThreaded property to true, and call the component ProcessMessages method instead.

     

    Angus 

     

     

    Ok, i fixed the routine to work both on main and on a thread. It works correctly locally but remotely it always connect OK even if the "server/port" is closed. Any ideas ?

    btw, doSocketRemoteClick has the same behavior.

     

    function IsInternetPortOpenICS(const AIPAddress: AnsiString = ''; const APort: Word = 0; const ATimeOut: NativeUInt = INFINITE): Boolean;
    var
        IpLogClient: TIcsIpStrmLog;
        FThreadID, FTimeout: NativeUInt;
    begin
        Result := False;
        try
           FThreadID := GetCurrentThreadId;
    
           IpLogClient := TIcsIpStrmLog.Create(nil);
           IpLogClient.LogProtocol := logprotTcpClient;
           IpLogClient.RemoteHost := AIPAddress;
           IpLogClient.RemoteIpPort := APort.ToString;
           //IpLogClient.onLogProgEvent := Form9.onCliLogProgEvent;
           //IpLogClient.CheckPing := True;
           //IpLogClient.PingWaitSecs := 1;
    
           if FThreadID <> MainThreadID then
             IpLogClient.MultiThreaded := True;
    
           IpLogClient.StartLogging;
    
           FTimeout := 0;
    
           while FTimeout < ATimeout do
           begin
             if FThreadID = MainThreadID then
               Application.ProcessMessages
             else
               IpLogClient.ProcessMessages;
    
             Result := IpLogClient.States[0] = logstateOK;
    
             if Application.Terminated or Result then
               Break;
    
             Inc(FTimeout, 10);
             Sleep(10);
           end;
    
    
           IpLogClient.StopLogging;
        finally
           if Assigned(IpLogClient) and IpLogClient.AnyStateOK then
             IpLogClient.StopLogging;
    
           FreeAndNil(IpLogClient);
        end;
    end;

     


  6. 5 hours ago, Angus Robertson said:

    The simplest way is with the TIcsIpStrmLog component, look at the doSocketRemoteClick procedure in the OverbyteIcsSnippets sample, although you can ignore SSL. 

     

    Failing to open a normal TCP connection will timeout after about 30 to 40 seconds, you can not easily make this any shorter, and you can not re-use the socket until the connection attempt fails, even if you abort it earlier.  If you need to check a lot of ports, either use multiple components running in parallel (no threads needed for hundreds) or use the ping feature of TIcsIpStrmLog to see if at least the IP address exists before checking the port.   

      

    Angus

     

    Hello Angus,

      How can i get the result ? (Is open or not) Do i have to use application.processmessages ? I'm going to use this routine in a thread.

    Thank you

     

    function IsInternetPortOpenICS(const AIPAddress: AnsiString = ''; const APort: Word = 0; const ATimeOut: NativeUInt = INFINITE): Boolean;
    var
        IpLogClient: TIcsIpStrmLog;
    begin
        try
           IpLogClient := TIcsIpStrmLog.Create(nil);
           IpLogClient.MaxSockets := 1;
           IpLogClient.LogProtocol := logprotTcpClient ;
           IpLogClient.RemoteHost := AIPAddress;
           IpLogClient.RemoteIpPort := APort.ToString;
           IpLogClient.CheckPing := False;
    
           IpLogClient.StartLogging;
           Result := // Check if connected ???
           IpLogClient.StopLogging;
        finally
           if Assigned(IpLogClient) and IpLogClient.AnyStateOK then
             IpLogClient.StopLogging;
    
           FreeAndNil(IpLogClient);
        end;
    end;

     


  7. 16 hours ago, Remy Lebeau said:

    A connect() timeout can be implemented by just using a non-blocking socket and close() the socket after the timeout elapses. If it uses a thread internally, that is just an implementation detail of the OS, but that shouldn't block the app from being able to move on.

     

    Well I'm using the following code to do what you're saying but for some reason it doesn't always work! Eg. even if the server port is closed it will return "True".

     


  8. Hello,

      Anyone knows how to copy the Bits from a ID3D11Texture2D  which it has different RowPitch than Bitmap.Width * 4 ?

     

      if FTexture.RowPitch = FBitmap.Width * 4 then
      for I := 0 to FBitmap.Height - 1 do
        Move(FTexture.pData[4 * FBitmap.Width * I], FBitmap.Scanline^, 4 * FBitmap.Width);
      else
        ?????

     

    Thank you

     


  9. bme.AddFrame(bm, false); It took 53 milliseconds to encode a 8k image faster than turbo-jpeg and with lower size as you say.

     

    Imagine using a TMemoryStream you can do whatever you want with the frames and i'll don't care about the expensive initialization.

     

    I don't understand why it creates a 10s video instead of 1s ...

     


  10. 4 hours ago, Renate Schaaf said:

    This is why that makes no sense (quoted from https://cloudinary.com/guides/video-formats/h-264-video-encoding-how-it-works-benefits-and-9-best-practices)

     

    "H.264 uses inter-frame compression, which compares information between multiple frames to find similarities, reducing the amount of data needed to be stored or transmitted. Predictive coding uses information from previous frames to predict the content of future frames, further reducing the amount of data required. These and other advanced techniques enable H.264 to deliver high-quality video at low bit rates. " 

    That goes to my first request " 1) Encode to Stream".

     

    As far the compression HEIF actually uses H.265 compression but there is not any hardware acceleration in Delphi or at least haven't found any!
    https://en.wikipedia.org/wiki/High_Efficiency_Image_File_Format

    HEIF files containing HEVC-encoded images are also known as HEIC files. Such files require less storage space than the equivalent quality JPEG.[2][3]


    Thank you

×