ICMP(ADMP) UNIX System V
Name
icmp - Internet Control Message Protocol
Syntax
#include <sys/socket.h>
#include <netinet/in.h>
s = socket(AFINET, SOCKRAW, proto);
Description
ICMP is the error and control message (or device) protocol
used by IP and the Internet protocol family. It may be
accessed through a ``raw socket'' for network monitoring and
diagnostic functions. The proto parameter to the socket
call to create an ICMP socket is obtained from
getprotobyname . [See getprotoent(SLIB).] ICMP sockets are
connectionless, and are normally used with the sendto and
recvfrom calls; the connect(SSC) call may also be used to
fix the destination for future packets (in which case the
read(S) or recv(SSC) and write(S) or send(SSC) system calls
may be used).
Outgoing packets automatically have an IP header prepended
to them (based on the destination address). Incoming
packets are received with the IP header and options intact.
Diagnostics
A socket operation may fail with one of the following errors
returned:
[EISCONN]
when trying to establish a connection on a
socket that already has one, or when trying
to send a datagram with the destination
address specified and the socket already
connected;
[ENOTCONN]
when trying to send a datagram, but no
destination address is specified, and the
socket has not been connected;
[ENOSR]
when the system runs out of memory for an
internal data structure;
[EADDRNOTAVAIL]
when an attempt is made to create a socket
with a network address for which no network
interface exists.
Files
/dev/inet/icmp
See Also
send(SSC), recv(SSC), intro(ADMP), inet(ADMP), ip(ADMP).
(printed 8/17/89) ICMP(ADMP)