t-mon / qtcoap

Constrained Application Protocol (CoAP) library written in Qt.
GNU General Public License v3.0
6 stars 5 forks source link

Error: "The server did not respond after 4 retransmissions." #2

Closed taimooralam closed 7 years ago

taimooralam commented 7 years ago

After the discover request from a local californium server (as well as the test server coap://vs0.inf.ethz.ch/)t , the reply is treated as an error and the program exists after giving the error. The error is Error: "The server did not respond after 4 retransmissions What may be the cause of the error?

   void Core::onReplyFinished(CoapReply *reply)
    {
       if (reply->error() != CoapReply::NoError) {  // this is where the error comes
          qDebug() << "Error:" << reply->errorString(); // this line gives the error: Error: "The server did not respond after 4 retransmissions."
           reply->deleteLater();
           exit(-1);
       }

       if (reply == m_discoverReply) { 
           qDebug() << "Discovery finished";
           qDebug() << "------------------------------------------" << endl;
           CoreLinkParser linkParser(reply->payload());
           foreach (const CoreLink &link, linkParser.links()) {
               qDebug() << link;
               qDebug() << link.path();
               dataList.append(new dataobject(link.title(), link.path()));
           }
           qDebug() << "Data change emitted";
       } ...
   ......
   }
t-mon commented 7 years ago

Hello! Can you send me the code where you create the CoapReply?

t-mon commented 7 years ago

Since CoAP is a UDP based protocol, each message has to be verified from the server within 2 seconds (according to the standard). If the server does not respond to the request, the message will be resent up to 4 times (also defined in the standard). That is the meaning of the error The server did not respond after 4 retransmissions. The client tried to send something 4 times and did not get any ACK from the server.

t-mon commented 7 years ago

I've tested the coap://vs0.inf.ethz.ch/, looks like the server does not work correctly at the moment. You can try coap://coap.me. If you need additional information about the traffic, build coap-cli from my repository and try to start it with -v:

coap-cli -d coap://coap.me -v 
t-mon commented 7 years ago

Can I close this issue since other CoAP clients do not work either on coap://vs0.inf.ethz.ch/?

taimooralam commented 7 years ago

Yes sure. I got my client working on a local server.

Thanks.

On Nov 30, 2016 11:12 AM, "Simon Stürz" notifications@github.com wrote:

Can I close this issue since other CoAP clients do not work either on coap://vs0.inf.ethz.ch/?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/t-mon/qtcoap/issues/2#issuecomment-263834733, or mute the thread https://github.com/notifications/unsubscribe-auth/AGAYOXivYbYPHgkydg62t-8SnKHzF5Ubks5rDUwCgaJpZM4K7sxz .