Menu

Application freeze when connection is broken

Help
2014-10-29
2015-01-04
  • Sergey Tkachenko

    Hello guys,
    Please exolain me, how to use TCP_UDPPort1 in tight way?
    In my case I try to make TCP_UDPPort1.Active:=True in Form1.Create procedure.
    This is work fine.
    Then, in Form1.Close I deactivete the TCP_UDPPort1.Active:=False;
    In this time the apllication may freeze.
    Also, if Ethernet connection was disconnected during application running, the application will freeze too.
    I use ISOTCPDriver1 for the connection to a machine.
    Rest of functions are working fine.

    Thanks in advance.

     
  • Fabio Luis Girardi

    Look into the unit tcp_udpport.pas at the line 70. You will see something like this:

    freconnectTimer:{$IFDEF FPC}TFPTimer{$ELSE}TTimer{$ENDIF};

    change it to:

    freconnectTimer:TTimer;

    In the same file, go to line 207, you will see something like this:

    freconnectTimer:={$IFDEF FPC}TFPTimer{$ELSE}TTimer{$ENDIF}.Create(nil);

    change it to:

    freconnectTimer:=TTimer.Create(nil);

    The problem is the TFPTimer, that uses a thread to do the timer job. Replace these lines and rebuild your application to see if it freezes again.

     

    Last edit: Fabio Luis Girardi 2014-10-29
  • Fabio Luis Girardi

    Sorry, are you using Lazarus?

     

    Last edit: Fabio Luis Girardi 2014-10-29
    • Sergey Tkachenko

      Code Typhon currently, but the problem the same with Lazarus.

       
  • Fabio Luis Girardi

    Ok! So the fix is in my second comment. Have you tried it?

     
  • Sergey Tkachenko

    Sorry for my late.
    As I remember the compiler cannot understand TTimer there.
    I will check once again.

     
  • Fabio Luis Girardi

    add the unit ExtCtrls to the interface uses

     
  • Sergey Tkachenko

    I did the changes.
    Application always freeze if it run with no connection.
    50/50 when connection disappear when the aplication work.
    And sometime freeze when I close the application.

     
  • Sergey Tkachenko

    Any ideas?

     
  • Fabio Luis Girardi

    Do you allow me to access your computer through Teamviewer or something else to see what happens?

    I have no idea...

     
  • Fabio Luis Girardi

    First, send a copy of your pascalscada, a copy of application that reproduces this, Codetyphon version and arch (typhon 32 or typhon64), OS version and OS architecture.

    I'll try reproduce this here. If I cannot reproduce, I'll ask to access you computer, only if agree.

     
  • Fabio Luis Girardi

    send it to fabio at pascalscada dot com

     
  • Fabio Luis Girardi

    I forgot: send together, the processor name and number of cores.

     
  • Sergey Tkachenko

    Sorry for my late again :)
    I was really busy to done the project with 20 PID regulators.
    They controls temperature and humidity in big sections (pasta production)
    So I did Operator's Panel with Pascal SCADA.
    Except this small confusion everithing run fine. I had disable automatic reconnection, at least the application is not freeze anymore. But there is necessary to close and start the application again.
    Not a big problem, I hope, because there is wired Ethernet connection, so the connection should not to disappear normally.

    Now I must say THANKS to Fabio, his product is really good!

    PS Later I will back to the question. Probably I have to try to compile the project on another PC.

     
  • Fabio Luis Girardi

    Thanks!!

    But how we can debug this? Can you send your application+pascalscada to me? Or maybe can I connect on your development station to see what happens?

    What's your suggestion?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.