Results 1 to 20 of 22

Thread: QTCP Socket Server and threads

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,369
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTCP Socket Server and threads

    Quote Originally Posted by cafu1007 View Post
    The problem of this solution without thread is if the main thread gets block because of re-sizing, moving the GUI or anything else that blocks the main thread, everything else will stop.
    The actions you mention do not block the thread.

    And i need to know if a value from the one being reading from the serial port changes and its in a critical range to do an action according to this...
    In that case using sockets is a bad idea at all. So is using a non-RT operating system. It can always happen that your application gets frozen by the operating system for a number of miliseconds. Threads will not help in any way here. Time critical conditions need real time operating systems. So it's either getting a real-time operating system or accepting that at times things can temporarily go out of control.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    May 2009
    Posts
    56
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTCP Socket Server and threads

    HI There, as i was recommended i am not using thread any where. Everything is running in a single thread (The main). but during debugging i see that at least 6 thread are created.

    is the any Qt class that creates new thread silently?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,369
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTCP Socket Server and threads

    Quote Originally Posted by cafu1007 View Post
    is the any Qt class that creates new thread silently?
    Yes, QFileSystemModel.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QTCP Socket Server and threads

    Also QNetworkAccessManager for HTTP requests: http://blog.qt.digia.com/2011/04/29/...accessmanager/

  5. #5
    Join Date
    May 2009
    Posts
    56
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTCP Socket Server and threads

    HI There,

    I was told that press down click event on the gui wil not stop the event loop.
    I monitor what is send and received in the serial port. When i hold down the mouse over the title bar for moving the Windows, there is not receiving information (i would say not read) from the serial port, i used Qextserialport class for serial communication. is this a Qt problem, Qextserialport or simply a block on the event loop?

    Thanks

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,369
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTCP Socket Server and threads

    This is somehow related to Windows display system. Qt has no influence on it since the title bar is not part of your application.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    May 2009
    Posts
    56
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTCP Socket Server and threads

    So how could i get around this. if i am not using threads. this is unwanted situation since everything should remain responding and communication should remain.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,369
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTCP Socket Server and threads

    Quote Originally Posted by cafu1007 View Post
    So how could i get around this. if i am not using threads. this is unwanted situation since everything should remain responding and communication should remain.
    I think you should not ask these questions in a thread called "QTcp Socket Server and threads" since this has nothing to do with sockets.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. How to disconnenct socket in server side?
    By Ali Reza in forum Newbie
    Replies: 1
    Last Post: 6th June 2012, 10:26
  2. Wait in thread till QTcp socket have some thing to read
    By hasnain in forum Qt Programming
    Replies: 2
    Last Post: 14th September 2010, 12:46
  3. threads and socket
    By babu198649 in forum Newbie
    Replies: 3
    Last Post: 10th April 2008, 15:34
  4. non GUI socket server
    By pdoria in forum Qt Programming
    Replies: 1
    Last Post: 3rd January 2008, 11:15
  5. question about socket and threads?
    By oob2 in forum Qt Programming
    Replies: 2
    Last Post: 27th February 2007, 11:42

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.