Jump to content

FPiette

Members
  • Content Count

    1120
  • Joined

  • Last visited

  • Days Won

    15

Posts posted by FPiette


  1. IMO it is not a good idea to unlock an locked file. Usually, a program lock a file because it is doing operation on the file which requires an exclusive access. Unlocking the file without shutting the program down will probably result in corrupted file or file in an inconsistent state when you access it (for example copy the file elsewhere).

    • Like 3

  2. 11 hours ago, PizzaProgram said:
    17 hours ago, FPiette said:

    You MUST create ICS component in the thread's Execute() method. Creating it in the thread's constructor will result of all events running in the main thread context.

    Well, I'm shocked. You were right!

    I've moved the creation of the components from the initialization part to the Execute procedure and It's the same fast now as Indy.

    Your ICS component event wre handled by the main thread which - you said that - is quite busy. Now that you created to component in thread's execute method, the events are handled by the thread. This is how Windows work with asynchronous operation (cooperative multitasking).

     

    11 hours ago, PizzaProgram said:

    I truly recommend, the future versions of the component should check, and raise an error if:

    1. The creation and running thread are not the same?
    2. The first initialization (of loading SSL DLLs) and final destruction is not running in the main thread!
    3. Property of .Multithreaded is True while running in a background thread? (Can be automated too.)

    We cannot change the component for you own need. You have the tools to do that in your own code. In the vast majority of programs using ICS component, no multithreading is ever needed. You have something wrong in your main thread for it to be so slow. Check your design and place multithreading where it is really helpful.

     

    I have an application using ICS that has more than 700 active users and yet doesn't make use of any thread. Both client and server are using ICS.

    • Like 1

  3. 2 hours ago, PizzaProgram said:

    Yes, I create those components in the background threads.

    You are not clear enough. You MUST create ICS component in the thread's Execute() method. Creating it in the thread's constructor will result of all events running in the main thread context.

    2 hours ago, PizzaProgram said:

    it would be a big mistake to put everything in the main thread. 🤯
     This is a POS program with a max user-response time of 50-100ms of the Main thread.

    The mistake is probably having the main thread with a less than 100mS response time. Are you polling devices from the main thread? If yes, that's there you have to move code to a thread.


  4. 28 minutes ago, PizzaProgram said:

    But ICS (+SSL initialization) is done only once before thread start.

    Doing like this is likely makes your ICS component in the main thread context.

    You should create the ICS component inside the thread execute method.

    29 minutes ago, PizzaProgram said:

    old Indy OpenSSL 1.0.2 and latest ICS 9.1 (OpenSSL 3.2)

    You cannot compare with different OpenSSL versions.

     

    Best performance with ICS is when using asynchronous operation and events. Synchronous operation will slow things down. You probably not even need a thread in the first place!


  5. 6 hours ago, kvk1989 said:

    So this method work over the internet? Or in tcp , ftp required server IP address?

    I told you to better describe your needs.

    Copy or CopyFile is Windows and it works whatever the physical network is between the two computers provided windows networking is running.

    TCP is a low level protocol that Windows Network use to implement his communication protocol (Which by the way is also implemented in Linux using SAMBA).

    FTP is a higher level protocol, making use of TCP to exchange files between two sites.

    IP address is the way to identify a computer inside a TCP/IP network.

    And there are many many more things that we cannot mention here (It would become a huge article).

     

    That's why you need to describe your needs.


  6. 8 hours ago, emileverh said:

    Can you give me a direction where to look for with what is the easiest way to find a MySQL server ( with port 3306 open) on my LAN (192.168.x.x)? 

    Just try to connect to each IP in the range(s) using a TWSocket. If connection succeed, disconnect and store the corresponding IP somewhere, then try the next IP.

    To speed up the process, you may use an array of TWSocket, each one scanning a sub-range. TWSocket is asynchronous so you don't even need to use threads.


  7. 10 hours ago, Vincent Parrett said:
    15 hours ago, David P said:

    Why is that?  Can multiple remote PCs connect to the Virtualhere server?

    because a usb device can only be used by one machine at a time. Virtualhere presents the device on the remote machine as though it were local. 

    I guess multiple remote PCs can connect, but only one at a given time. The connected PC must disconnect to allow another to connect. Just guessing.

    • Like 1

  8. 10 hours ago, Vincent Parrett said:

    You know Hyper-V server has been discontinued right?

    Only the free version is discontinued!

    Here is what Jeff Woolsey, Principal PM Manager at Microsoft is saying:

    The only thing that was discontinued was the FREE Microsoft Hyper-V Server product because we simply don’t have the time and resources to keep producing the free version. That’s it. That’s the only thing that was deprecated. [explanation skipped] In short, Hyper-V is here for the very long run.


  9. In the program to be monitored, add code to make it answer to a message (for example a TCP socket or a pipe or a Windows message).

    Write a second program launch the first and periodically connect to the main program and check if he gets an answer.

    If no answer, it kills the program et start it again.

    When the second program starts the first (CreateProcess), it gets an handle that can be waited to catch when the program stops normally.

     

    • Like 1

  10. 12 hours ago, PeaShooter_OMO said:

    I would expect the listening Server side to be in its own thread and perhaps hand off some major work to another thread, even socket access.

    A good architecture, scalable architecture, is to have ONE thread for the server component for a given protocol. That thread will handle all client communications (that's OK for up to one thousand clients) and unload any processing to worker threads.

    You can also consider splitting the application between different processes which will handle a single protocol and possibly use IPC to make those processes talk to each other if required. Having a single process doing everything is the best way to have an unstable system almost impossible to debug.

    • Like 1

  11. If you want to use ICS in threads, a good design would be to have all socket activity executed by the thread itself. If the data to be sent comes from another thread or received data must be processed by another thread, don't share the ICS component but use standard inter-thread communication techniques to do the transfert. Note that processing by ICS is not a CPU intensive process so you won't gain much using thread. Instead it is better to keep actual data processing along with the ICS component in the thread. For example, you can use a thread in a server application to handle a single client (or a few hundreds). Use ThreadAttach and ThreadDetach to move socket handling from one thread to another thread.

     

    Writing a multi-threaded application is hugely more complex than a single-threaded application, debugging is particularly difficult. You benefit from thread when computing can be done in parallel. For file transfer operation, there is almost no processing involved so benefit is low.

     

    Don't forget that the real network throughput is frequently the limiting factor. And even if you have a fast hardware speed (1Gbps for example) doesn't means that the network card you have is able to sustain such throughput.

     

     


  12. 2 hours ago, WalkingAway said:

    But itself your framework / libaray is quite good base for simple / educational projects.

    Midware has been developed for professional projects. It has been used for more than 10 year in a large scale application having more than 700 concurrent users on a LAN. Backend database was MS-SQL server. It has also been used it many smaller applications.


  13. Thank you for trying Midware.

    The library doesn't support Unicode nor SSL.

    Unfortunately, I do not maintain this library anymore. But you are welcome to update the source code and mail it to me 😉

    To make it working, you has to understand how it works... It should no be too complex to update the code for SSL.


  14. Do you want the exe with shared for to be launched by one application each time the application needs the form? It would be quite inefficient and you'll have to manage having several instances of the form hosting application. It is possible, but will be quite complex...

     

    Instead, you can put the form inside a DLL that each application will load. Or even simpler, just compile the form's code into the 5 applications.

     

×