-
Notifications
You must be signed in to change notification settings - Fork 424
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
Possibility to use libcoap with an external event loop #1554
Comments
It is good that you are trying to provide libcoap support within other programming environments. I think all that you need to do is call ( This will then also handle any packet re-transmits etc.
Good question that I do not have an answer for. I don't think that CoAP is going to go away though. |
I also call this function periodically in some cases but that is something I would like to avoid. In case of a control application for a physical device, I think the function would be called unnecessarily most of the time as nothing changes. So I would set a comparatively high cycle time (maybe 100+x ms). On the other hand, this might slow down file transfers considerably. I guess adding access functions for these two struct properties would be the least invasive change (only read for fd and read&write for flags). Would you accept such a PR? If yes, I saw that the fd property is not present on all platforms. Could the corresponding access function simply return zero if the property does not exist? |
coap_io_process() will not wait for the full timeout specified if an input is received, or an internal libcoap timeout has occurred (i.e. for a packet re-transmission). So providing it is repeatably called, this should not slow down blocked transfers, but I guess it is possible.
I don't see why not if it makes sense. However, to not to have to change the flags, I would make
One of the reasons why structures are kept opaque is because of different build type sizes. In this case, I would return |
Thank you! |
Sorry, I have to reopen this as I accidentally missed the following issues: The However, to use Thank you! |
Hm, I think I got it wrong. Please ignore the second part for now. I have to think about it again next week with a fresh mind. |
I think I want to tackle this from a different direction.
So, if you have a new function (e.g. [Trying to shoehorn in |
#1556 is not complete - need a timeout mechanism for the non epoll case. This is needed for packet retransmission etc. I could use the |
Sure - that should work. |
I have just added to So, |
Works with #1556, thank you! |
Hello,
as many CoAP implementations seem to have ceased development 2-3 years ago, I am experimenting with integrating libcoap in other programming languages (Python via ctypes, C# via PInvoke and JS). I was able to get examples running in these cases but had to add workarounds. One workaround was necessary because I need to integrate libcoap into an existing event loop as epoll and select() are not (fully) available.
I saw that I can call
coap_io_prepare_io
to get a list ofcoap_socket_t
that contain the FDs and the event types. Unfortunately, this struct is in an internal header. I copied the struct to my code for this workaround and I was able to use libcoap with the other event loop. My question is, is there an officially supported way to integrate libcoap in a separate event loop that I missed and if not, would it be possible to makecoap_socket_t
public or add access function to thefd
andflags
properties?Btw., do you have an idea why many lost interest in CoAP? In my environment many people are using MQTT. I see the advantage that most of the complexity is in the broker but for my use cases I want direct communication and CoAP also offers other benefits.
Thank you!
The text was updated successfully, but these errors were encountered: