ping_host_add(3)
β¨ NAME β¨
ping_host_add β bestie, this is literally the function that adds a host to a liboping object π (it's from the liboping manual, section 3, iykyk)
πΈ SYNOPSIS πΈ
#include <oping.h>
int ping_host_add (pingobj_t *obj, const char *host);
int ping_host_remove (pingobj_t *obj, const char *host);
okay so two little icons live here and they're a matching set, we love a duo π
π DESCRIPTION π
So ping_host_add is the main character here. What it does is: it tries to resolve the host argument, open a socket, and then associate everything with the liboping object obj. Like it's matching them up. Obsessed.
The obj argument is a pointer to a liboping object, as returned by ping_construct(3). So you don't just make one out of thin air, bestie, you gotta get it from there first π«Ά
The host parameter is a '\0' terminated string which gets interpreted as a hostname or an IP address. Depending on the address family setting β which you set with ping_setopt(3) β the hostname gets resolved to an IPv4 or an IPv6 address. It's giving "choose your fighter" β¨
Then there's ping_host_remove. This one looks for host inside obj and removes it if it's found. And it's thorough too: it will close the socket and deallocate the memory, too. Cleanup queen π
β οΈ The names passed toping_host_addandping_host_removemust match. Like, exactly. And if you're sitting there going "wait, what name did I use", you can query it usingping_iterator_get_info(3)π
π₯ RETURN VALUE π₯
If ping_host_add succeeds it returns zero. If an error occurs, a value less than zero is returned and the last error is saved internally. You can receive that error message using ping_get_error(3). So you're never left on read π
ping_host_remove returns zero upon success and less than zero if it failed. Currently the only reason for failure is that the host isn't found, but this is subject to change. Use ping_get_error(3) to receive the error message.
π SEE ALSO π
π AUTHOR π
liboping is written by Florian "octo" Forster <ff at octo.it>. Its homepage can be found at <http://noping.cc/>. Absolute icon behavior, fr fr.
Copyright (c) 2006-2017 by Florian "octo" Forster.
okay and that's the whole page bestie!! this was the liboping version 1.10.0, dated 2017-05-11 β ty for coming to my ted talk, go add some hosts πβ¨π¦πΈππ π«Ά
π¦ where this page comes from
- alpine 3.24: liboping-doc 1.10.0-r2 Β· LGPL-2.0-or-later
- epel 10: liboping-devel 1.10.0-33.el10_0 Β· GPL-2.0-only
- epel 9: liboping-devel 1.10.0-19.el9 Β· GPLv2
- fedora 43: liboping-devel 1.10.0-35.fc43 Β· GPL-2.0-only
- fedora 43: liboping-devel 1.10.0-35.fc43 Β· GPL-2.0-only
- fedora 44: liboping-devel 1.10.0-36.fc44 Β· GPL-2.0-only
- fedora 44: liboping-devel 1.10.0-36.fc44 Β· GPL-2.0-only
- nixos 26.05: liboping 1.10.0
- nixpkgs unstable: liboping 1.10.0
- opensuse-leap 16.0: liboping-devel 1.10.0-bp160.1.14 Β· LGPL-2.1-only
- opensuse-leap 16.0: liboping-devel 1.10.0-bp160.1.14 Β· LGPL-2.1-only
- opensuse-leap 16.0: liboping-devel 1.10.0-bp160.1.14 Β· LGPL-2.1-only
- opensuse-leap 16.0: liboping-devel 1.10.0-bp160.1.14 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms