Jump to content

mitzi

Members
  • Content Count

    64
  • Joined

  • Last visited

Posts posted by mitzi


  1. Hello,

     

    I need to implement TCP client(s) in thread(s) with reconnect feature (if connection is closed with error then client tries to reconnect) which should run in service. I created server and client demo app to test this concept but I met following issues and I'm really not able to find out what's wrong in my implementation.

    1.  When I run server, start it and start internal client (client implemented the same exe) server throws "error:00000000:lib(0):func(0):reason(0), State: before SSL initialization, connection closed unexpectedly" in OnSslHandshakeDone and disconnects client. When I start (the same) client as standalone exe, it works.
    2. When I run and start server, then run and start standalone client and then kill server app (to simulate connection error) client starts to reconnect and when server is started again TWO client connections are established (!?) from client application. The second one is correct and the first one is some ghost or whatever.
    3. Sometimes while client tries to reconnect after text is received from server or sent to server, first connection attempt causes various exceptions and client thread is terminated.

     

    Can you please inspect my code in attachment? Test self-signed certificate for SSL is included (SSC.pfx).

     

    Thanks in advance

     

    ICSTCP.ZIP


  2. DFM Editor allows edit and create Borland Delphi VCL/FireMonkey Forms in text and binary format. It is compatible with all Borland/Codegear/Embarcadero development tools (Delphi, Builder, BDS, RAD).
    DFM Editor can extracts forms from compiled executables and DLLs (or others Portable Executable files) by its extraction tool.
    Syntax highlihting editor with code folding, object inspector and object tree view are tools that make work easier.
    There's form preview tool available so you can view form in WYSIWYG mode.
    DFM Editor allows also user packages (*.bpl) registration to make included components to be known to DFM Editor.

     

    For more information see https://www.mitec.cz/dfm.html

     

    DFM_001.png

    DFM_002.png

    • Like 1
    • Thanks 1

  3. What is Project Maker?

     

    MiTeC Project Maker is tool for automated batch Delphi projects building. With Project Maker, you can set compiler and its configuration, define actions processed before and after building, patch version information of built binary, sign this binary with specified certificate, apply 3rd-party software protection and many more.

     

    How does Project Maker work?

     

    Project Maker offers clear powerful interface for project building task definition. Every project can contain unlimited number of tasks. Task represents Delphi project, defined in dpr or dproj file. In addition Project Maker features Profiles, where you can define common properties for project. The project can have unlimited number of profiles. Using profiles you can simply switch between variety of build configurations.

     

    Who is Project Maker targeted on?

     

    Project Maker is targeted on developers who need to make various build scenarios and make repeated actions automatic. Project Maker is simple but powerful and provides one-click building of very complex and dependent projects.

     

    For more information see https://www.mitec.cz/pm.html

     

    PM_001.png

    • Like 1

  4. New version 2.3.0 released

     

    + Paquet Builder, WinUPack, PC Guard, Enigma Protector, InstallShield, Delphi 10.4, CAB archive and VMWare Installation Launcher data detection added
    * Fixed bug in version info reading
    * Fixed DOS executables detection
    + Delphi 10.4 Sydney compatibility

     

    For more information about the library, download locations and documentation, see the MiTeC Portable Executable Reader Home Page


  5. New version 14.1.0 released

     

    * TMiTeC_MUS - Fixed available updates detection in 32-bit version
    + TMiTeC_MUS - Added Update History detection and available updates detection information extended
    + TMiTeC_MUS - Added Demo 32
    * TMiTeC_Storage - Fixed assigning logical drives to physical devices

    + TSysProcMonThread - Added additional settings properties (PerformanceMeasuring, EvaluateSecurityInfo, RetrieveProcessIcon, RetrieveProcessVersionInfo)

     

    For more information about the library, download locations and documentation, see the MiTeC System Information Component Suite Home Page

     

    MSICSBanner.png


  6. New version 14.0.0 released

     

    + TProcListMonThread, TSysMonThread, TProcMonThread and TSysModListMonThread merged to new one - TSysProcMonThread (MSI_ProcListMon.pas, MSI_SysMon.pas, MSI.ProcMon.pas, MSI_SysModListMon -> MSI_SysProcMon.pas)
    + TMiTeC_SysProcMon - CPU usage measuring rewritten and precised - process cpu cycle time is used to usage calculation
    + TMiTeC_SysProcMon - CPU clock frequency evaluation rewritten - now it is based on real power distribution
    + TMiTeC_SysProcMon - Handle enumeration rewritten to reflect latest available APIs
    + TMiTeC_SysProcMon - System process module enumeration added
    + TMiTeC_SysProcMon - Windows 2000 compatibility fixed
    + TMiTeC_SysProcMon - Thread start address symbol evaluation
    + TMiTeC_Security - added product state, component rewritten->new interface
    + TMiTeC_SMBIOS - Windows 2000 compatibility fixed
    + TMiTeC_Storage - added SMART data reading for USB disks
    + TMiTeC_SMBIOS - initial SMBIOS 3.4 compliance
    + TMiTeC_SMBIOS - Hardware Security table 24 added
    + TMiTeC_SMBIOS - OEMM strings table 11 added

    + FPC/Lazarus compatibility

     

     For more information about the library, download locations and documentation, see the MiTeC System Information Component Suite Home Page

     

    MSICSBanner.png


  7. Well but this is what I ask for. How did you (or others) solve this scenario? Your suggestion is ping. Well, when ping is successful it tells me nothing about my TCP server, if it is running and listening or not. Other suggestion is to abort connection attempt with timer. But it creates new problem with socket reusing. So what?

    It seems there's no useful advice. I will try to make my own port scan via WinSock.Select with timeout set to 5 secs (as I did in my post above for Delphi Socket component) before TWSocket.Connect. Disadvantage is when server is on, then i will do two connection attempts. First by port scan and second with real client connect.  Another one is that this is blocking attempt. 😞

    Anyone has better solution?


  8. No I don't have this intent. I found ICS very usable, but this is, in my opinion, key property ICS should have.

    I just wanted to point that this timeout is possible to be set. You wrote it is not possible by design. It seems it is not true.

    So my question is whether it is possible to implement this timeout setting to ICS?

     

    Consider this situation. I have primary TCP server and backup TCP server. Clients are connected to primary one. If this primary server goes down for any reason, then client loses connection and tries to reconnect. But it can take 20 secs now than it finds server is really inaccessible and then connects to backup server. This reconnection should be as short as possible. Mostly if client is not able to connect within 5 secs server can be considered as inaccessible and then connection to another backup server is processed. But 20 secs is really too long.

     

    Your recommendations how to solve this problem when connection timeout cannot be set?


  9. If ICS uses WinSock.Select for connection then timeout can be set via latest parameter.

    Look at following code sample. I modified method from Delphi System.Win.ScktComp.pas and it does exactly what I want. Sets timeout for connection attempt to 5 secs. Originally it took 20 secs too. But I can't use these components :(.

     

    procedure TCustomWinSocket.DoOpen;
    var
      v: integer;
      WrSet   : TFDSet;
      TimeVal : TTimeVal;
    begin
      DoSetASyncStyles;
      Event(Self, seConnecting);
    
      v:=1;
      IOCtlSocket(FSocket,FIONBIO,v);
      try
        CheckSocketResult(Winapi.WinSock.connect(FSocket, FAddr, SizeOf(FAddr)),'connect');
        TimeVal.tv_sec:=5;
        TimeVal.tv_usec:=0;
        FD_ZERO(WrSet);
        FD_SET(FSocket,WrSet);
        if Select(0,nil,@WrSet,nil,@TimeVal)<>1 then
          CheckSocketResult(1,'select');
      finally
        v:=0;
        IOCtlSocket(FSocket,FIONBIO,v);
      end;
    
      FLookupState := lsIdle;
      if not (asConnect in FAsyncStyles) then
      begin
        FConnected := FSocket <> INVALID_SOCKET;
        Event(Self, seConnect);
      end;
    end;

    Couldn't be something like this implemented to ICS?

×