protected override void DoGet(CoapExchange exchange) { // Accept the request to promise the client this request will be acted. exchange.Accept(); // ... and then do nothing. Pretty mean... }
protected override void DoGet(CoapExchange exchange) { // Accept the request to promise the client this request will be acted. exchange.Accept(); // Do sth. time-consuming Thread.Sleep(2000); // Now respond the previous request. Response response = new Response(StatusCode.Content); response.PayloadString = "This message was sent by a separate response.\n" + "Your client will need to acknowledge it, otherwise it will be retransmitted."; exchange.Respond(response); }
protected override void DoPost(CoapExchange exchange) { exchange.Accept(); exchange.Respond(SERVER_RESPONSE); }