---
name: "ping_send"
section: "3"
platform: "linux"
package: "liboping-dev"
version: "1.10.0-5+b5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/ping_send"
---

# ping\_send(3)

Send ICMP echo requests to all associated hosts and wait for ICMP echo responses to arrive

## NAME

ping\_send - Send ICMP echo requests to all associated hosts and wait for ICMP echo responses to arrive

## SYNOPSIS

```
  #include <oping.h>
  int ping_send (pingobj_t *obj);
```

## DESCRIPTION

The **ping\_send** method is the actual workhorse of this library. It crafts ICMP packets for the hosts associated with *obj* and sends them via the corresponding sockets. It then waits for echo responses and receives them, writing latency information for each host. The method returns after all echo replies have been read or the timeout (set with [**ping\_setopt**(3)](/ping_setopt/3.md)) is reached.

After this function returns you will most likely iterate over all hosts using [**ping\_iterator\_get**(3)](/ping_iterator_get/3.md) and ping\_iterator\_next (described in the same manual page) and call [**ping\_iterator\_get\_info**(3)](/ping_iterator_get_info/3.md) on each host.

## RETURN VALUE

**ping\_send** returns the number of echo replies received or a value less than zero if an error occurred. Use [**ping\_get\_error**(3)](/ping_get_error/3.md) to receive an error message.

## SEE ALSO

[**ping\_construct**(3)](/ping_construct/3.md), [**ping\_setopt**(3)](/ping_setopt/3.md), [**ping\_iterator\_get**(3)](/ping_iterator_get/3.md), [**ping\_iterator\_get\_info**(3)](/ping_iterator_get_info/3.md), [**ping\_get\_error**(3)](/ping_get_error/3.md), [**liboping**(3)](/liboping/3.md)

## AUTHOR

liboping is written by Florian "octo" Forster \<ff at octo.it\>. Its homepage can be found at \<http://noping.cc/\>.

Copyright (c) 2006-2017 by Florian "octo" Forster.
