Results 1 to 5 of 5

Thread: QT DLL based on QWebSocketServer called from MFC application

  1. #1
    Join Date
    Dec 2015
    Location
    Rome
    Posts
    16
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows
    Thanks
    1

    Default Re: QT DLL based on QWebSocketServer called from MFC application

    Hi all,
    I written a QT DLL based on QWebSocketServer class and link it to a MFC application.
    Initialization is ok and listen function too but it happens that websockets calls from web pages are locked.
    It seems a that the connection are not managed, I think the QT DLL needs some messages processor or similar.

    Have you some suggestion?


    I tried with QApplication:rocessEvents() but nothing good happens.

    Some suggestion ?

    sorry for my English.


    Added after 34 minutes:


    I solved (temporary) calling QApplication::exec() within DLL but this solution is not good.
    Last edited by oop; 11th February 2016 at 11:03.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: QT DLL based on QWebSocketServer called from MFC application

    You probably don't need a QApplication, you could try with a QCoreApplication.

    You either need to run the application object's event loop or move your socket stuff into a QThread and run its event loop.

    Cheers,
    _

  3. #3
    Join Date
    Dec 2015
    Location
    Rome
    Posts
    16
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows
    Thanks
    1

    Default Re: QT DLL based on QWebSocketServer called from MFC application

    Hi, thx for answer.
    Yes I derived from the more light QCoreApplication and it works fine for me.
    QCoreApplication have less dipendencies than QApplication.

    There is a way to wait a signal on new event to dispatch rather than call processEvent ciclically?

    Thx :)

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: QT DLL based on QWebSocketServer called from MFC application

    QCoreApplication::exec() runs the event loop in a loop, no need for processEvents().

    That loop waits until it gets any event, e.g. socket, timer, and then dispatches it to the designated receiver/handler object.

    If the receiver emit signals as a result of the event you can handle them with the usual signal/slot mechanism.

    Cheers,
    _

  5. #5
    Join Date
    Dec 2015
    Location
    Rome
    Posts
    16
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows
    Thanks
    1

    Default Re: QT DLL based on QWebSocketServer called from MFC application

    Hi, I solved following your second suggestion (move instance of QCoreApplication into a QThread) and then
    call QCoreApplication::exec(). It are working very fine for me.
    It is simple also quit all, it is enought to call QCoreApplication::quit() from mainthread and wait QThread::wait() for, thus end main thread.

    Regards,
    Giorgio

Similar Threads

  1. Replies: 1
    Last Post: 7th November 2014, 11:15
  2. Replies: 6
    Last Post: 6th November 2014, 19:21
  3. Replies: 3
    Last Post: 5th October 2011, 16:45
  4. Replies: 2
    Last Post: 6th July 2010, 13:35
  5. Replies: 7
    Last Post: 20th March 2010, 06:05

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.