-
Notifications
You must be signed in to change notification settings - Fork 3.1k
expose ping function to lua #1555
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
Comments
This would be helpful, I currently use net.dns.resolve() with a return IP address as a pseudo ping to check web connectivity. I use the MQTT server URL as the "pinged" address to in effect not only confirm general web connectivity but connectivity to the IP in play. With the above said, to use your suggested ping function, I would have to do a dns resolve to get the IP first but I will only do it to confirm that the IP has not changed. I also assume the response size and speed from a ping will be smaller and faster when compared to a dns resolve. |
Given that you didn't ask for an ICMP ping implementation I'd vote to close this.
There are several alternatives available in the firmware (plain socket,
In order to properly search you'd need more than just a ping anyway. |
I agree, we need protection against a "Ping of Death". |
May I propose to reopen the issue, please? I hope that ping from Lua Land may be one of the first windfall results from my dealing with ethernet driver implementation (issue #1725).
The promise is
and although I agree that there are other ways of network diagnose, people (including me) will like it. However, smcl patches So we might
I would ask the guardians of the code for a proposal hwo to proceed. |
ping pings :-)
I haven't yet decided on a place in namespace. |
Following are the changes in the
and
For reference, these are the complete definitions fof the relevant structs in
From my (still limited) understanding of C, the addition of the However, the change from Would it be a solution to include a field like |
ok, just hacked this backreference, looks like it works. |
OK, I catched the reboot issue on ping when WIFI down. There are still some quirks with converting illegal IP numbers, but this is done by lwIP itself, and I do not dare to fiddle with this. If somebody wants to try before the namespace question is settled: file added:
files changed:
Presumably it even could handle callbacks on pings received, but I haven't tested. |
I think this is a great addition, good job!
I suggest making it net.ping().
|
Good stuff.
We prefer small isolate PRs for isolated features rather than one big blob.
👍 |
OK, sounds good.
So would I. But I'd like to keep the goal in mind, which was an ethernet driver. Do file names and module names have any other connection rather than by convention? I simply could keep the file in place and rename it to After obvious cleanup of tutorial scrap, this is what the function map definition might look like
OK, change all And I think I 'm supposed to supply Documentation - at least in some later PR to come. And how can I merge module maps across files? I see there is a subfolder How is all this handled in |
I'd even propose to integrate
There are advanced concepts like inheritance or overloading, but they are most likely overkill.
From what I see in the snippets above you don't need it. Replacing its reference with NULL should to the trick. There are several modules like this. NODEMCU_MODULE(TEST, "test", test_map, NULL);
Documentation for changed or new API functions should go into the corresponding location beneath |
I was earlier supportive of Pretty much every NodeMCU firmware out there includes the So, I propose to create a new module called "netinfo" or so. For now the only function it'd offer is |
So what aobut calling the file Poor man's name space structuring, so to say :-) The lua bindings for lwIP Can you agree with that? |
Still struggling with git :-(((
So far, so good.
Tried to squash commits, following Reverted to tarball and tried a merge
Looks like all my recent commits are lost :-( before the merge, it looked like this: Obviously I should not have assigned the commit "ping test" to dev??? |
http://www-cs-students.stanford.edu/~blynn/gitmagic/
So it's not me who is the idiot? |
hopelesly lost in GIT :-( but when I try to do a Looks like moving files back and forth, partially reverting to old versions, different by some whitespace only, and merging those commits upsets the automagic? I tried a push, but received I suggest giving up the squeezing of commits in order not to ruin the stage fo work reached now. If not, please give me detailled instructions. |
Just branch off from a current A hint for rebase/squash safety: if unsure, do a trial of these on a separate branch and prevent your WIP from being messed up.
At some point you'll know what works and what not. Just repeat the cycle and learn from the results. Your feature branch remains a safe fallback. |
I see, there is only chance to learn git the hard way. Powerful beast, but beast, nevertheless. But your proposal made me confident to try it again. But now I think I know (roughly) the cause of the problem: I had marked a commit as I squashed this commit out, but by calling
I tried to anchor my world at this quirky intermediary local dev state from the trash bin . To fix it , I did instead
And - alas - everything worked like a charm. I hope this PR is digestible for you now. |
Dear @marcelstoer There is a an untested feature in the PR: While this functionality is not necessary for network diagnosis from the console, there may be users who want to write diagnosis from lua clients, e.g. http, mqtt or so. |
Dear all, I can see that PR #1757 has been closed and there was no follow-up. I think it's a pity as good work has been done by @wolfgangr. I took his code and found that it fits my simple needs. The only issue I had a problem with was the memory leak. I did not find a proper solution how to free the memory properly. I've tried to count callbacks and free the memory on the last one but it led to restart in majority of cases. Please check https://github.com/vsky279/nodemcu-firmware/tree/ping, especially this commit vsky279@79c8b36. Is it ready for PR or are there any further substantial flaws? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
So the net.ping() ICMP Command won't come? |
Ok, I have created a PR #2854. Let's see reactions whether it is accepted to be merged into |
Missing feature
ping function
Justification
ping function will help the developer to know if there is connectivity to web and search for other devices in local network
Workarounds
I am currently using net module and doing post requests
The text was updated successfully, but these errors were encountered: