You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems CoAP.NET is not ready for this feature. Microcontroller is configured to respond to CoAP multicast address (224.0.1.187), I am opening a client to this coap endpoint "coap://224.0.1.187/" and I was expecting to discover all the resources of all available CoAP devices on the network. But it seems I am only getting the first one.
I tried to do as follows:
CoapClient client = new CoapClient(new Uri("coap://224.0.1.187/"));
client.Respond += Request_Respond;
var result = client.Discover().ToList();
for (; ; )
{
Thread.Sleep(1000);
}
The code above only returns the first device replying to the request. I also tried as follows:
static void CoAPMulticast()
{
// new a GET request
Request request = new Request(Method.GET, false);
request.Multicast = true;
request.URI = new Uri("coap://224.0.1.187/.well-known/core");
request.Respond += Request_Respond;
request.Send();
for (; ; )
{
Thread.Sleep(1000);
}
}
private static void Request_Respond(object sender, ResponseEventArgs e)
{
Console.WriteLine("Here");
}
I was expecting function "Request_Respond" to print twice the "Here", but I can see on the logs that the second response is being ignored.
@mfalkvidd Thank your for the reply. I did verify and checked the multicast request reached both devices and both devices response reach CoAP.NET. I could verify this with Wireshark and also via logs generated on the console by CoAP.NET.
The issue seems to be the Discover method is only expecting one response (which usually it is fine). I guess a method called "DiscoverAll" could be created and return an IEnumerable of Devices with weblinks. If that seems fine to you, I could implement it and open a merge request for you.
I don't have control over this repository, and I don't use multicast myself, but your suggestion sounds good.
I'm not sure anyone is maintaining this repo anymore. I submitted a pull request quite a while ago: #64
I would prefer that this repo remained the "true" source for the project, but you are welcome to submit a pull request to my fork if you have no luck here.
Activity
mfalkvidd commentedon Feb 13, 2020
Does the request reach all the clients? Should be easy to verify by checking the logs for multiple devices.
Do all the clients' responses reach the computer where the client is running? Easiest way to verify is probably to run wireshark on the computer.
Alv3s commentedon Feb 13, 2020
@mfalkvidd Thank your for the reply. I did verify and checked the multicast request reached both devices and both devices response reach CoAP.NET. I could verify this with Wireshark and also via logs generated on the console by CoAP.NET.
The issue seems to be the Discover method is only expecting one response (which usually it is fine). I guess a method called "DiscoverAll" could be created and return an IEnumerable of Devices with weblinks. If that seems fine to you, I could implement it and open a merge request for you.
mfalkvidd commentedon Feb 13, 2020
I don't have control over this repository, and I don't use multicast myself, but your suggestion sounds good.
I'm not sure anyone is maintaining this repo anymore. I submitted a pull request quite a while ago: #64
I would prefer that this repo remained the "true" source for the project, but you are welcome to submit a pull request to my fork if you have no luck here.
There are a few other forks as well: https://github.com/smeshlink/CoAP.NET/network