Results 1 to 7 of 7

Thread: Serial and TCp and threadss

  1. #1
    Join Date
    Sep 2007
    Location
    Germany
    Posts
    35
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Serial and TCp and threadss

    Hi everybody i have a small question i have several serial devices, each of then need to be check all the time, plus the possibility to set some stuff on then. I also have a server and several client connected using QtcpSocket and QtcpServer.

    The clients are the one that see the information and set thing to serial devices.

    I have a made a thread for each serial, and a thread that control the the server as well a thread for the client.

    things seems to work properly but i am affraid that this is no a good solution.

    The client should send a request to the server, the server say to the device that need to perfomed a command the answer is receive and the is transmited to the client,

    in the meantime the client should not be able to send a new command but it can receive message from the server.

    Beside Thread for wait and no block the guis(clients and server), what other option do i have.
    CAFU......

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Serial and TCp and threadss

    Why do you think your threaded solution is not good?
    And if it works, then what is the problem?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

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

    Default Re: Serial and TCp and threadss

    Hi, it is working, but the software should run in pc that only have one procesor, and at the end it can be more than 10 thread working together, and i am not sure how this is going to work, andit does not matter how many test i make, i can not see all the problem that this can cause

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

    Default Re: Serial and TCp and threadss

    Hi there,

    Something else: the serial devices(class) trigger signals(the same signature) that are connected to same slot in the controller. What happen when the devices trigger a the same time the signal.
    What happens when the the slot is processing some data in the slot and a new signal is triggered, What happens if in the slot, i block with a mutex and a second signal is triggered.


    This is no so clear for me. Could someone explain me this. I am not sure whether is going to be a deadlocks, or lost of signal or this are going to be queued

    Thanks for the help

  5. #5
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Serial and TCp and threadss

    If signal emiter and receiver are in one thread in standard mode emiting signal is de facto calling receiver function. So event loop is not working until receiver returns.
    If signal emiter and receiver are in different threads signals are queued. Look here

  6. #6
    Join Date
    Sep 2007
    Location
    Germany
    Posts
    35
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Serial and TCp and threadss

    well they are in different thread so they should be queued,


    Thanks.

    one thing with the BlockingQueuedConnection as soon as the slot can be called the other signaling thread is unblock
    CAFU......

  7. #7
    Join Date
    Sep 2007
    Location
    Germany
    Posts
    35
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Serial and TCp and threadss

    HI,

    i am having some issues i am running the application in the deploy machine, and its given me error when i closed or sometimes when i opened, it saying the the application crash and drWatson had a log entry. the target machine is running Windows XP embedded, but when i tried to debug in my machine everything goes ok no error and no crashing.

    can someone read the log from dr watson an maybe give some hints.

    thanks carlos
    CAFU......

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.