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