UCNTL crap, default units, rm fixed bugs
[unix-history] / usr / src / share / man / man4 / icmp.4
CommitLineData
f29f3a8b
MK
1.\" Copyright (c) 1986 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
5.\" @(#)icmp.4 6.1 (Berkeley) %G%
6.\"
7.TH ICMP 4P ""
8.UC 6
9.SH NAME
10icmp \- Internet Control Message Protocol
11.SH SYNOPSIS
12.B #include <sys/socket.h>
13.br
14.B #include <netinet/in.h>
15.PP
16.B s = socket(AF_INET, SOCK_RAW, proto);
17.SH DESCRIPTION
18ICMP is the error and control message protocol used
19by IP and the Internet protocol family. It may be accessed
20through a \*(lqraw socket\*(rq for network monitoring
21and diagnostic functions.
22The
23.I proto
24parameter to the socket call to create an ICMP socket
25is obtained from
26.IR getprotobyname (3N).
27ICMP sockets are connectionless,
28and are normally used with the
29.I sendto
30and
31.I recvfrom
32calls, though the
33.IR connect (2)
34call may also be used to fix the destination for future
35packets (in which case the
36.IR read (2)
37or
38.IR recv (2)
39and
40.IR write (2)
41or
42.IR send (2)
43system calls may be used).
44.PP
45Outgoing packets automatically have an IP header prepended to
46them (based on the destination address).
47Incoming packets are received with the IP header and options intact.
48.SH DIAGNOSTICS
49A socket operation may fail with one of the following errors returned:
50.TP 15
51[EISCONN]
52when trying to establish a connection on a socket which
53already has one, or when trying to send a datagram with the destination
54address specified and the socket is already connected;
55.TP 15
56[ENOTCONN]
57when trying to send a datagram, but
58no destination address is specified, and the socket hasn't been
59connected;
60.TP 15
61[ENOBUFS]
62when the system runs out of memory for
63an internal data structure;
64.TP 15
65[EADDRNOTAVAIL]
66when an attempt is made to create a
67socket with a network address for which no network interface
68exists.
69.SH SEE ALSO
70send(2), recv(2), intro(4N), inet(4F), ip(4P)