Results 1 to 1 of 1

Thread: How to delay program close to allow time for functions to finish

  1. #1
    Join Date
    Mar 2014
    Location
    USA
    Posts
    78
    Thanks
    15
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to delay program close to allow time for functions to finish

    I have 2 qt programs, they are two separate qApps. I use QTcpServer and QTcpSocket on localnet so that they can talk to each other and simulate a network. They are actually going to run on a real TcpIP network with a server computer and client computers when it's finished, but I only have one computer to work with for development and testing. Using localnet with different ports is the only way I could think of to simulate it. How they expect me to develop a network program without a network for testing with is beyond me, but I have to make do with what they give me. Government job (I'm thinking of leaving because of this kind of crap, plus they treat contractors like trash. I would use stronger, more accurate language, but this is a family friendly environment ). In the real world, when the client gets locked, the server will still be running, and I think under those conditions it will work great, but I have no way of verifying it. I've been using qDebug to find out what's happening and at what time when it locks/unlocks. The problem is the server hits the lock event and stops before the client even hits the lock event much less process and send the data. How can I delay the server program from stopping until after it reads and processes the data that was sent to it? The client keeps running until the function I call finishes (6 ms), so I'm 99% sure that part of the program is working as designed. I think if I could put some kind of delay function in the lock event that doesn't stop other functions from running, that would work. I think 1 second would be way more than enough. I think there might be a way to use QWaitCondition to accomplish this, but I don't seem to be able to figure it out. I found solutions on line, but posts after the "solution" all say don't do it that way, it could cause cpu lock. BUT they don't offer an alternative.


    Added after 1 27 minutes:


    Forget this post, I found out the server has to run with the computer in lock screen, so I have to find a way to make the sever and client run as a service. Lucky me. If anyone has any ideas on that one, I'm all ears but I'm not expecting an answer since it has nothing to do with this post. There used to be a way to do it with Qt, but it only works with XP, nothing from Vista and up.
    Last edited by TonyInSoMD; 31st August 2018 at 13:30.

Similar Threads

  1. are there functions for delay in Qt?
    By rezas1000 in forum Newbie
    Replies: 7
    Last Post: 25th June 2018, 09:15
  2. Time Delay for show Color in PushButton
    By yrandom in forum Newbie
    Replies: 1
    Last Post: 28th April 2017, 19:22
  3. A slot cause program to finish unexpectedly
    By SIFE in forum Qt Programming
    Replies: 3
    Last Post: 7th July 2012, 13:08
  4. open-close-suspend-resume mouse functions in QWSServer
    By masterbraind in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 9th November 2010, 22:07
  5. setToolTip time delay
    By h123 in forum Qt Programming
    Replies: 2
    Last Post: 9th November 2008, 10:20

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.