morkai / h5.coap

Implementation of the Constrained Application Protocol (CoAP) client for node.js.
MIT License
61 stars 11 forks source link

Failure to fetch coap://coap.me/.well-known/core #1

Closed tobyjaffey closed 10 years ago

tobyjaffey commented 10 years ago

When I try to fetch coap://coap.me/.well-known/core using h5.coap, the connection times out.

tobyjaffey commented 10 years ago

I believe this was an IPv6 DNS issue on my PC.

morkai commented 10 years ago

tl;dr Right now, the Client doesn't support domain names in URIs.

Sent requests are saved in a map, where a key includes the : (in this case: coap.me:5683). When the response comes, the domain name is not known, so it cannot match to the request and so the request times out.

Before sending a request, it should check whether the specified remote endpoint address contains a domain name or an IP address. If it's a domain, then it should be resolved to an IP address, the endpoint address should be changed to that IP and the Uri-Host option set to the domain name.