'ping' Library Call?

Is there an easy way to determine connectivity to an IP address
from inside a process, something simple like ‘ping’?

Jeff