Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

ping is icmp not udp


It's super confusing because you can use udp to read icmp packets (but not send, iirc), and i might be wrong, but i remember seeing tuts that did this!!


Getting downvoted, so:

https://stackoverflow.com/questions/13087097/how-to-get-icmp...

Using a udp socket is the "classic" way of implementing ping on low privilege syystems


“udp” in this context means unprivileged data gram, not UDP the protocol. For some reason go uses the confusing “udp” name in parts of its API. The docs for this kind of socket seem to only exist on the kernel commit: https://lwn.net/Articles/420800/


You can kindly ask the kernel networking stack to inform you of errors, but that is not the same as "using udp to read icmp packets".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: