Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How Do I Use the libcoap Component to Receive and Send Coap Packets in the Same Function? #1523

Open
shenhaicheng opened this issue Sep 23, 2024 · 4 comments

Comments

@shenhaicheng
Copy link

shenhaicheng commented Sep 23, 2024

Is your feature request related to a problem? Please describe.

Currently, an api needs to be provided. I need to send CoAP packets in the api and set the response to the output parameter.

Describe the solution you would like

A function that can process responses synchronously is required. Is this function supported in the current version? Thank you so much for supporting!

@mrdeep1
Copy link
Collaborator

mrdeep1 commented Sep 24, 2024

I'm trying to understand what you are looking for here. Are you looking for something like

/*
 * Send a request PDU and wait for the response PDU.
 * 
 * @param request_pdu The requesting PDU. This PDU cannot contain the Observe CoAP option. 
 * @param response_pdu If there is a response, the response PDU is put here.
 *                      This PDU must be freed off by the caller after processing.
 *
 * @return @c 1 if success, else @c 0 on failure (response_pdu set to NULL). request_pdu is always freed off.
 */
int coap_send_recv(coap_pdu_t* request_pdu, coap_pdu_t** response_pdu);

@shenhaicheng
Copy link
Author

I'm trying to understand what you are looking for here. Are you looking for something like

/*
 * Send a request PDU and wait for the response PDU.
 * 
 * @param request_pdu The requesting PDU. This PDU cannot contain the Observe CoAP option. 
 * @param response_pdu If there is a response, the response PDU is put here.
 *                      This PDU must be freed off by the caller after processing.
 *
 * @return @c 1 if success, else @c 0 on failure (response_pdu set to NULL). request_pdu is always freed off.
 */
int coap_send_recv(coap_pdu_t* request_pdu, coap_pdu_t** response_pdu);

Yes, I'm really looking for this,but I can‘t find this interface. T.T

@mrdeep1
Copy link
Collaborator

mrdeep1 commented Sep 24, 2024

Yes, I'm really looking for thisbut I can‘t find this interface. T.T

This interface does not exist - someone needs to write it - I don't have spare time at present.

@mrdeep1
Copy link
Collaborator

mrdeep1 commented Oct 28, 2024

@shenhaicheng Appreciate that time has passed, but please try out #1538 where there is not support for coap_send_recv().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants