Long-term headless app work: QTcpSocket receive do not

We have an app without long-term head that uses sockets for IPC.

Headless part contains a QTcpServer, the user interface of the QTcpSocket.

the code without a head:

server = new QTcpServer(this);
bool ok = connect(server, SIGNAL(newConnection()), this, SLOT(onNewConnection()));server->listen(QHostAddress::LocalHost, m_port);

user interface code:

bool stateOk = connect(clientSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(onStateChanged(QAbstractSocket::SocketState)));
if (!clientSocket->isOpen()) {
    clientSocket->connectToHost(QHostAddress::LocalHost, m_port);
    bool conOk = connect(clientSocket, SIGNAL(connected()), this, SLOT(connected()));
    bool disconOk = connect(clientSocket, SIGNAL(disconnected()), this, SLOT(disconnected()));
    bool readReadOk = connect(clientSocket, SIGNAL(readyRead()), this, SLOT(commandReceived()));
    bool errorOk = connect(clientSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(error(QAbstractSocket::SocketError)));
    Q_ASSERT(errorOk);
    qDebug() << "connected to server socket";
}

output debug shows headless headless app is running constantly, the signal is properly connected, the socket for the server returns isListening() to true.

debug output of the user interface shows that all signals are correctly connected, and onStateChanged goes from HostLookupState to ConnectingState and finally to ConnectedState

At this point, I'd wait the server socket to pull the signal of newConnection, but alas, it isn't.

I generate and run the xandos example and it works correctly, but it does not long-term use and has the server in the user interface, while the part without head connects.

I suspect that the app without head doesn't have an event loopand QTcpServer documentation states:

Although QTcpServer is mostly designed for use with an event loop,it's possible to use it without one.In that case, you must use waitForNewConnection(),which blocks until either a connection is available or a timeout expires.

Now I wonder:

The long March without head app has an event loop?

If this is not the case, how best to use the blocking call without disabling the rest of its features? A thread?

Write that post little got me on the right track already, a problem merging caused the socket to the server must be started before you call the constructor of the Application (which provides the event loop).

Now the server is running, receive a few orders, then she stops unexpectedly, the fires of the user interface
QAbstractSocket::RemoteHostClosedError changes the State of ClosingState and UnconnectedState

Tags: BlackBerry Developers

Similar Questions

  • Just got 2 of SE. Weather app works on one but not the other.

    Just got 2 of SE. Weather app works on one but not the other. Ideas?

    Drosea,

    Define/describe does not.

    What's the weather App?

  • SystemDialog in long running headless app

    Hello

    10.3.1 I have a use case where I need to display a popup when a condition is met. The app may not run at the time when the condition could be filled.

    I looked at the following statement of the documentation

    «Apps headless supports dialog boxes at a later version of the SDK or API 10.3 level native BlackBerry 10.» Single system dialogs, such as SystemDialog, are supported. »

    on the page

    https://developer.BlackBerry.com/native/documentation/Cascades/device_platform/headless_apps/index.h...

    In this case, I modified the existing sample to take advantage of the SystemDialog but I don't see the dialog box when I installed the app (part of the user interface) since the outbreak in the part of the user interface for the headless is as follows. Any ideas?


    application.headless
    Reminder service
    ReminderService

    bb.action.system.STARTED
    application/vnd.blackberry.system.event.STARTED



    com.example.ReminderService.RESET
    *


    Here's the part without the project: service.hpp

    #ifndef SERVICE_H_
    #define SERVICE_H_

    #include
    #include
    #include

    bb {} namespace
    Application class;
    namespace System {}
    class InvokeManager;
    class InvokeRequest;
    }
    }

    Class service: public QObject
    {
    Q_OBJECT
    public:
    Service();
    Virtual ~ Service() {}

    public slots:
    void onDialogFinished (bb::system:ystemUiResult::Type type);

    private slots:
    void handleInvoke (const bb::system:InvokeRequest &);)
    void onTimeout().

    private:
    void triggerNotification();

    BB::System:InvokeManager * m_invokeManager;
    BB::System:ystemDialog * m_dialog;
    };

    #endif / * SERVICE_H_ * /.

    Here is the service.cpp

    #include "service.hpp".

    #include

    #include

    #include

    #include

    #include

    #include

    using namespace bb::system;

    Service:ervice():

    QObject(),

    m_invokeManager (new InvokeManager (this))

    {

    m_invokeManager-> connect (m_invokeManager, SIGNAL (called (const bb::system:InvokeRequest &)),)

    This, SLOT (handleInvoke (const bb::system:InvokeRequest &)));))

    m_dialog = new SystemDialog ("Save as", "Discard changes", "Cancel");

    m_dialog-> setTitle ("save changes");

    m_dialog-> setBody ("save your changes and close the document?");

    m_dialog-> setEmoticonsEnabled (true);

    m_dialog-> setModality (SystemUiModality::Global);

    Connect the finished() signal to the onDialogFinished() location.

    The slot will check the SystemUiResult to see which

    button has been operated.

    Boolean success = connect (m_dialog,

    SIGNAL (finished (bb::system:ystemUiResult::Type)).

    This,

    SLOT (onDialogFinished (bb::system:ystemUiResult::Type)));))

    If (success) {}

    Signal has been connected successfully.

    Now, display the dialog box in your user interface.

    onTimeout();

    } else {}

    Unable to connect to report.

    This is not normal in most cases and can be a critic

    situation for your application! Make sure you know exactly why

    What happened. Add code to retrieve from the

    interruption of the connection under this line.

    m_dialog-> deleteLater();

    }

    }

    cancel the Service:nDialogFinished (bb::system:ystemUiResult::Type type)

    {

    If (type is SystemUiResult::ConfirmButtonSelection)

    {

    qDebug()< "dialog="">

    The user accepts the dialogue.

    }

    else {}

    qDebug()< "dialog="">

    The user rejected the dialog box.

    m_dialog-> deleteLater();

    }

    }

    void Service::handleInvoke (const bb::system:InvokeRequest & request)

    {

    If (request.action () .compare ("com.example.ReminderService.RESET") == 0) {}

    triggerNotification();

    }

    }

    Sub Service: triggerNotification()

    {

    Time-out is to give time for the user interface to minimize

    QTimer::singleShot (2000, this, SLOT (onTimeout (()));

    }

    cancel the Service:nTimeout()

    {

    m_dialog-> show();

    }

    Join the discussion at
    http://supportforums.BlackBerry.com/T5/native-development/SystemDialog-in-headless-part-in-10-3/TD-p...

  • HTTP access from a long running headless app

    Hello

    I have a requirement for an application that runs without head 24/7 and must sometimes make remote HTTP connections without user interaction.

    Could you please tell me if this is possible thanks to an application without head and point me to the api correct?

    Thank you

    Ray

    you don't know.
    the api is the same as always, usually QNetworkAccessmanager etc.

  • my app works in ripple, but not in real device :(

    I made a request of 'fitness' with webwork development,

    It works very well in ripple and build, with success.

    but BB app world answer me it shows a blank page so it rejected, & I shocked when seen on real device from my friend did not work and the really white page

    I do not know

    how it works well on the training and do not work on the real device!

    Good luck.  If you're stuck on how to do it, here is the complete documentation on how to perform debugging using Web Inspector:

    https://developer.BlackBerry.com/HTML5/documentation/web_inspector_overview_1553586_11.html

  • jdev app works on defaultServer, integratedServer not again using appSrv DataS

    The ear that I created using JDev deploys and works very well on my workstation integratedServer. I had to set up a secondary server to collect all the necessary information for the guys of our operation for the application to be installed there. I was able to run the application with the data source in the application but optimal, we need the shared data source on a global scale on the appServer. The application spreads very well, but I get the message below when I try to use the data source on the appServer.

    I noticed that it seems that he has a problem with ejb session bean, which is quite surprising. All the session bean classes are present in the jar and the sessionEJB is the only bean company listed in the file ejb - jar.Xml.

    Our deadliine is August 22 to have the app has ended and we have several other environments stand and test in the meantime.


    Here is the message from the log file

    Exception [EclipseLink-7060] (Eclipse persistence Services - 1.2.0.v20091016 - r55)
    (65): org.eclipse.persistence.exceptions.ValidationException
    Description of the exception: could not acquire the data source [java: / app/jdbc/jdbc/j2eo_user]
    DS].
    Inner exception: javax.naming.NameNotFoundException: while trying to look up
    / App/JDBC/JDBC/j2eo_userDS in app/ejb/EOD_Model_ejb.jar#SessionEJB. ; remaining
    name "/ app/jdbc/jdbc/j2eo_userDS.
    at org.eclipse.persistence.ex

    Thank you very much
    Tracy

    Although don't usually deploy you your applications to the AdminServer, it shouldn't make a difference.

    You can try the forums WLS, these guys here tend to be much better versed in aspects of the administration like this.
    John

  • App works on XP, but not Win 7

    I'm trying thinapp some application we use. Here are a few details... If I have this package on a Windows XP computer, I can deploy virtual machines Windows XP but not the 64-bit Windows 7 machines.

    As I'm going down to XP, I then created a computer package 64-bit Windows 7, SP1... I used this machine to install the application, the application works fine, so I know that the application can operate perfectly well on Windows 7 x 64... I go ahead and wrap it up. I then went back to my own os snapshot and try to run the application packaged on the same machine that I packed on and no luck. The Windows Setup program starts to run for some reason any and then I get "cannot find the specified file" I tried setting the WOW64 and tried a certain isolation modes: fusion and WriteCopy.

    Any ideas? I wasn't looking to pack on Windows 7 32-bit because I is not currently using it in my environment

    Mike

    Mike,

    I ThinApp had Wavereader 4.2 successfully after a lot of troubleshooting, tested on XP and Win 7 (32/64).

    Can you IM your personal email so I can send you the ThinApp project folder integer (except the bin folder) via dropbox?

    All you need is just run the file build.bat which includes your ThinApp license and creates the bin for you.

  • Long-term process works do not at all

    What has happened recently and there has been any changes made on the server (with the exception of restart the server after finding thereon.).  No process for a long time are now working at all.  The rendering process (short term) seem to work, but if it must go beyond that, it doesn't happen.  And there is no sign that the process never exisited at all. First of all, we have seen what happens when we went to finish the process isolated running on the server.  She did not allow for us to do.  We have attached an image of the error.  Then we tried to run new processes and that's when we found that they are not created.

    This led to think there may be something wrong in the database, the table process was left down or something.  But when we looked at the table was actually there.  We decided to create a new test process that would make a simple form, pre filled with the common name of the users and when the user has clicked done, would route itself back to this user.  After that, he would.  The goal was just to see if we could spend whatever it is.  Needless to say that this test has failed.  The party made worked, but the process never goes beyond.  The end user (in the workspace) gets no indication that something is wrong.  It seems that the process works well.  But in the administration console, you won't see any instance of the process.  The process table is created, but no data in it.

    We then decided to attempt to invoke the process of the work bench.  We received an error when you try to do.  I have attached a picture of this error also.

    Anyone have any ideas?  Any help with this is greatly appreciated.

    invoke_from_workbench_error.JPG

    terminate_process_error.JPG

    If something fails it will generate a stack trace in the newspaper... You can go through the support, at this stage, as there is not much we can do for you here.

    Paul

  • Long-term storage of inkjet all-in-one (F4480)

    Is there a good way to prepare for storing ink jet printers long-term (> 1 year) so that the jets get clogged?

    We have a F4480 deskjet all-in-one that has not been used in several months.  As far as I know it still works fine.  It has been stored in the original box & delivery packaging for 3 months.  We hope it won't be necessary for 1-2 years.  We had 2 former HP hoof to the top after a long period without use.  I said that they should be tested every month or two.  Do you need >

    This model integrates print on ink supplies heads, so in the worst case, you'll just need to replace the cartridges.  I think after a year or two ink supplies will probably dried out or clogged.   When you restore the printer to the service, you may be able to run up to three cycles of cleaning of the Toolbox.  Is there is an impression, but it is scratched or one or more colors are missing, then soak the nozzles of the cartridges down in about 1 "of very hot water for 10 minutes can recover the cartridges.

    The best plan would be to simply use the cartridges before long-term storage and then store the low or empty cartridges in the printer.

    For best results, store the printer with cartridges installed.  Be sure to turn off the printer to its power switch and wait for the cartridges to Park properly before removing the power.  Store the printer in a place cool and away from drafts, pets and other potential hazards.  Make sure that the printer is stored standing in its normal operating position.  Store the printer upside down or sideways or the end can cause problems.

  • . MOV for Long term

    I'm converting to digital using Roxio Video Capture video old VHS of my family. It works very well but is that the only question I have... .Mov format is good for long-term file storage? Should I upgrade to something more universally used like MP4?

    Your analog conversion rate is a source of poor quality in the first place, and you won't get anything else that standard definition quality no matter what your use container.

  • is iCloud for storing long-term reliable?

    For storing long-term valuable family photos?

    It is an excellent product to store your valuable photos and videos, but notes, store them on all your devices.  iCloud is not a traditional backup cloud based storage platform.  In other words, you cannot remove photos from a device once they are stored in iCloud thinking you will save space this device because, once removed, it removes all devices.  If you agree with this, then sure, go ahead and use iCloud for your photos/videos.  If you are looking for a traditional backup cloud storage platform, consider these third party apps like Dropbox, Flickr or Google Photos (my favorite).  Good luck!

  • "My friends find" app works in Cancun?

    Go to the Mexico. "My friends find" app works in Cancun?

    As long as you have an internet connection active to provide data.

  • Long-term file types (i.e., 'Microsoft Visio Drawing') vs short ("XLS" for Excel files) displayed in a detailed view of the folder

    In my point of view of folder, file types include long-term (i.e., "Microsoft Visio Drawing" and some are abbreviated ("for Excel files XLS).) Before this machine, all my types of files have been long-form... How can I get the form long back for all of my files?

    Have you tried to create a macro - see this

    http://www.MrExcel.com/Forum/showthread.php?t=525026

    If you save stencil files and model that are designed to work together, to ensure that their design page, styles, and colors settings are compatible. For more details, see http://msdn.microsoft.com/en-us/library/aa200991(v=office.10).aspxChapter 10, Managing Styles, sizes, and Colors.

  • Record of long-term key error

    I tried today to save my keys using the ide from qnx, using the windows--> preference - signature of the steps, but I get the same error. "The long-term key registration error" & "error connection abort: connect.

    Do I need to get new keys too? Thank you for your help

    Hi Mark, it worked. Set the path, he was not able to find the file .csj. and then moved the files in the bbndk folder, and it has worked. I wonder why the Wizard failed. But thank you very much

  • Reinstal Cloud but not uninstal not possible as long as the app running, but not other applications in the Task Manager

    Hello

    I need to reinstall the Cloud but uninstal is not possible as long as the app running, but not other applications in the Task Manager.

    Windows 7

    Uninstaller: "another version of office of creative cloud or an installer Adobe is running...". »

    TaskManager: browser runs only.

    Windows Installer / change: "unable to désinstaller creative cloud to desktop. You still have creative Cloud computer applications that need it.

    So, how I re install this, thank you

    Safe mode using the application of Creative Cloud Uninstaller has worked.

Maybe you are looking for

  • When I try to start firefox I get a message that says proxy server refusing conections

    problems last night macafee said something was trying to download on my computer wanted t allow I said no then everything froze for a few minutes, when everything was closed and I try to restart firefox, I got the proxy server message refusing to con

  • Satellite A500 - 1GL Boot menu and Hyperthreading question

    OK, I have 2 questions. The first is on the start menu, one that says Toshiba and a then press F2 for Setup and F12 (I think) for boot order.Basically I turned off in the menu of the bios so that it would be faster to start up the computer.But now, h

  • LabVIEW 8.5 pda pda module and terralogic

    Hi all I currently use module 8.5 pda to develop an application and have it run successfully on both a HP Ipaq 5550 running Pocket PC 2003, and also a Sony Ericcson X 1 phone running Windows Mobile 6. My client is about to get your hands on a Terralo

  • music msn my computer certificate is expired or invalid.

    I managed to transfer my music files purchased from my old computer to a a flash and then drive to my new computer, but I am currently having problems authorizing my music files on it. I think the problem is that the music from my computer certificat

  • The Task Manager will not open in Server 2003

    I'm troubleshooting why the Task Manager does not open in Server 2003.  This is an option when I right click on the taskbar, but when I click on it it does not open.  I try to type taskmgr.exe in the command run and it says "windows cannot find taskm