Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Italian
  4. Due messaggi da server fortune
Qt 6.11 is out! See what's new in the release blog

Due messaggi da server fortune

Scheduled Pinned Locked Moved Unsolved Italian
2 Posts 2 Posters 757 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MontanaroM Offline
    MontanaroM Offline
    Montanaro
    wrote on last edited by
    #1

    Ciao

    sto provando a mandare due messaggi utilizzando l'esempio fortune (client /server ) modificato.

    Il server dovrebbe spedire al cliente, due messaggi:

    1- un primo messaggio di avvenuta connessione
    2- un secondo messaggio dopo tot tempo che avvisi di un' operazione avvenuta

    Il client alla ricezione di questi due messaggi dovrebbe visualizzare due messaggi:

    1- sullo schermata di connessione il messaggio che avvisa della avvenuta connessione
    2- un messagebox che avvisa dopo un tot di tempo dell'avvenuta connessione.

    Sotto il codice client.

    Il mio problema è che i due avvisa sul client escono in contemporanea quando è stato spedito il secondo messaggio ma invece vorrei che uscissero a distanza di tempo rispettando l'invio.

    Nota. in realtà i messaggi sono spediti con un unico pacchetto.

    E' possibile prendere la prima parte del pacchetto e stamparla a video
    e successivamente prendere la seconda parte del pacchetto e stamparlo a video ?

    *void Client::readFortune()
    {

    while(1)
    {
    
    in.startTransaction();
    
    QString nextFortune;
    in >> nextFortune;
    
    // if (!in.commitTransaction())
    //    return;
    

    // if (nextFortune != "CONNESSIONE APERTA") {
    if (nextFortune != currentFortune) {

        // status_server->setText(currentFortune);  
    
    
    
        if (count==1)
        {
         QMessageBox::information(this, tr("WARNING"), nextFortune);
       // QTimer::singleShot(0, this, &Client::requestNewFortune);               
      //   return;   MODIFICA
    
        }
        count++;
    }
    
    
      currentFortune = nextFortune;                   
     statusLabel->setText(currentFortune);
    

    }*

    1 Reply Last reply
    0
    • mrdebugM Offline
      mrdebugM Offline
      mrdebug
      wrote on last edited by
      #2

      Ciao, se i messaggi arrivano insieme poiché nello stesso pacchetto l'unica cosa da fare è di mostrare subito il promo messaggio e mettere il secondo in una lista che, a intervalli di un secondo ad esempio, un timer eventualmente andrà a mostrare e svuotare.
      Noto un while(1), sei un firmwareista?
      Ti consiglio di usare l'approccio ad eventi oppure un thread apposito.

      Need programmers to hire?
      www.labcsp.com
      www.denisgottardello.it
      GMT+1
      Skype: mrdebug

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved