-
Notifications
You must be signed in to change notification settings - Fork 78
Description
I have been playing with this library to discover CoAP devices using my own library on the microcontroller (ESP8266): https://github.com/Alv3s/Thing.CoAP
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.
Any tips? Maybe I could help you with this one.