Results 1 to 8 of 8

Thread: How to use QProcess to write multiple commands to external console based program.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Join Date
    May 2011
    Location
    Sweden
    Posts
    4
    Qt products
    Qt3 Qt4 PyQt3 PyQt4
    Platforms
    Unix/X11
    Thanks
    2

    Default Re: How to use QProcess to write multiple commands to external console based program.

    Quote Originally Posted by wysota View Post
    Ok, but probably it takes some time for your system to bring the connection up. The fact that "ifconfig" returns doesn't mean the network is ready for use. If you perform the check immediately after running the commands, you are creating a race condition. Why don't you use Bearer Management API available in Qt Mobility to detect connection changes?
    OK I did not know about this API, I will give it a go and see if it solves the problem. Thanks


    Added after 1 21 minutes:


    Quote Originally Posted by wysota View Post
    Ok, but probably it takes some time for your system to bring the connection up. The fact that "ifconfig" returns doesn't mean the network is ready for use. If you perform the check immediately after running the commands, you are creating a race condition. Why don't you use Bearer Management API available in Qt Mobility to detect connection changes?
    I tried to use Qt Mobility but in my scenario it is useless. The reason I need to disable and enable network interface is that my network card sometimes (randomly) gets disabled by my Linux (Slackware 13.37) kernel.
    I tried to resolve that issue at Linux forums but as it seems its a bug in Slackware release or with my card driver. Anyway the only workaround is to disable and enable the card that makes it reusable without restarting the system.
    I tried doing the same thing with Qt API but it seems it can not disable the interface. It gives error "The requested operation is not supported by the system"

    Anyway! You were spot on ... it was a race condition because it takes some time for the network interface to become available, so I forced it to delay (sleep(5)) for 5 seconds and it solved my problem. Thanks once again.
    Last edited by Fraz; 13th September 2011 at 13:15.

Similar Threads

  1. running external console program by gui program
    By alireza.mixedreality in forum Qt Programming
    Replies: 4
    Last Post: 24th April 2010, 18:05
  2. [QProcess] Calling console program
    By bgarisn in forum Newbie
    Replies: 3
    Last Post: 25th February 2010, 15:11
  3. Replies: 5
    Last Post: 17th July 2009, 12:17
  4. Replies: 1
    Last Post: 1st December 2008, 21:02
  5. QProcess start a console program
    By Shawn in forum Qt Programming
    Replies: 2
    Last Post: 9th November 2007, 12:38

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.