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

Numeric IP in datasource URL fails #3

Open
fjansson opened this issue Apr 17, 2017 · 1 comment
Open

Numeric IP in datasource URL fails #3

fjansson opened this issue Apr 17, 2017 · 1 comment

Comments

@fjansson
Copy link

If myConfig.url contains a numeric IP address, the connection does not succeed. If it contains a name which resolves to the same IP address, fetching data works.

The reason seems to be in httpclientFetch(), where espconn_gethostbyname() is called to resolve the hostname part of the URL. Once the name is resolved, this function calls a callback function which handles the rest of the connection. However, if the IP address is known immediately, espconn_gethostbyname() returns directly and does NOT call the callback function, which means that passing an IP address results in the connection failing.

I tried checking the return value of espconn_gethostbyname() and call the function myself. This still did not work, apparently because the network connection was not complete by the time this function was called. It seems espconn_gethostbyname() also provides a way here to ensure that the connection is up before proceeding.

This is an issue in the original code, but it is not on GitHub, so I post it here.

@Oliv4945
Copy link
Owner

Hi @fjansson,
You can try this forum, the author is one of the moderators.

Also, maybe you can use espconn_connect.
See this example they have a #ifdef DNS_ENABLE which can help you.

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