CoAP.Request.Send C# (CSharp) Метод

Send() публичный Метод

Sends this message.
public Send ( ) : Request
Результат Request
        public Request Send()
        {
            ValidateBeforeSending();
            EndPoint.SendRequest(this);
            return this;
        }

Same methods

Request::Send ( IEndPoint endpoint ) : Request

Usage Example

Пример #1
1
        public void TestConfirmable()
        {
            // send request
            Request req2acc = new Request(Method.POST, true);
            req2acc.SetUri("localhost:" + _serverPort + "/" + ACC_RESOURCE);
            req2acc.SetPayload("client says hi");
            req2acc.Send();

            // receive response and check
            Response response = req2acc.WaitForResponse(100);
            Assert.IsNotNull(response);
            Assert.AreEqual(response.PayloadString, SERVER_RESPONSE);
            Assert.AreEqual(response.Type, MessageType.CON);

            Request req2noacc = new Request(Method.POST, true);
            req2noacc.SetUri("coap://localhost:" + _serverPort + "/" + NO_ACC_RESOURCE);
            req2noacc.SetPayload("client says hi");
            req2noacc.Send();

            // receive response and check
            response = req2noacc.WaitForResponse(100);
            Assert.IsNotNull(response);
            Assert.AreEqual(response.PayloadString, SERVER_RESPONSE);
            Assert.AreEqual(response.Type, MessageType.ACK);
        }
All Usage Examples Of CoAP.Request::Send