1*61596Sbostic.\" Copyright (c) 1986, 1991, 1993 2*61596Sbostic.\" The Regents of the University of California. All rights reserved. 328253Skarels.\" 443581Strent.\" %sccs.include.redist.man% 528253Skarels.\" 6*61596Sbostic.\" @(#)icmp.4 8.1 (Berkeley) 06/05/93 733126Sbostic.\" 847675Scael.Dd 947675Scael.Dt ICMP 4 1047675Scael.Os BSD 4.3 1147675Scael.Sh NAME 1247675Scael.Nm icmp 1347675Scael.Nd Internet Control Message Protocol 1447675Scael.Sh SYNOPSIS 1547675Scael.Fd #include <sys/socket.h> 1647675Scael.Fd #include <netinet/in.h> 1747675Scael.Ft int 1847675Scael.Fn socket AF_INET SOCK_RAW proto 1947675Scael.Sh DESCRIPTION 2047675Scael.Tn ICMP 2147675Scaelis the error and control message protocol used 2247675Scaelby 2347675Scael.Tn IP 2447675Scaeland the Internet protocol family. It may be accessed 2547675Scaelthrough a 2647675Scael.Dq raw socket 2747675Scaelfor network monitoring 2828253Skarelsand diagnostic functions. 2928253SkarelsThe 3047675Scael.Fa proto 3147675Scaelparameter to the socket call to create an 3247675Scael.Tn ICMP 3347675Scaelsocket 3428253Skarelsis obtained from 3547675Scael.Xr getprotobyname 3 . 3647675Scael.Tn ICMP 3747675Scaelsockets are connectionless, 3828253Skarelsand are normally used with the 3947675Scael.Xr sendto 4028253Skarelsand 4147675Scael.Xr recvfrom 4228253Skarelscalls, though the 4347675Scael.Xr connect 2 4428253Skarelscall may also be used to fix the destination for future 4528253Skarelspackets (in which case the 4647675Scael.Xr read 2 4728253Skarelsor 4847675Scael.Xr recv 2 4928253Skarelsand 5047675Scael.Xr write 2 5128253Skarelsor 5247675Scael.Xr send 2 5328253Skarelssystem calls may be used). 5447675Scael.Pp 5547675ScaelOutgoing packets automatically have an 5647675Scael.Tn IP 5747675Scaelheader prepended to 5828253Skarelsthem (based on the destination address). 5947675ScaelIncoming packets are received with the 6047675Scael.Tn IP 6147675Scaelheader and options intact. 6247675Scael.Sh DIAGNOSTICS 6328253SkarelsA socket operation may fail with one of the following errors returned: 6447675Scael.Bl -tag -width [EADDRNOTAVAIL] 6547675Scael.It Bq Er EISCONN 6628253Skarelswhen trying to establish a connection on a socket which 6728253Skarelsalready has one, or when trying to send a datagram with the destination 6828253Skarelsaddress specified and the socket is already connected; 6947675Scael.It Bq Er ENOTCONN 7028253Skarelswhen trying to send a datagram, but 7128253Skarelsno destination address is specified, and the socket hasn't been 7228253Skarelsconnected; 7347675Scael.It Bq Er ENOBUFS 7428253Skarelswhen the system runs out of memory for 7528253Skarelsan internal data structure; 7647675Scael.It Bq Er EADDRNOTAVAIL 7728253Skarelswhen an attempt is made to create a 7828253Skarelssocket with a network address for which no network interface 7928253Skarelsexists. 8047675Scael.El 8147675Scael.Sh SEE ALSO 8247675Scael.Xr send 2 , 8347675Scael.Xr recv 2 , 8447675Scael.Xr intro 4 , 8547675Scael.Xr inet 4 , 8647675Scael.Xr ip 4 8747675Scael.Sh HISTORY 8847675ScaelThe 8947675Scael.Nm 9047675Scaelprotocol appeared in 9147675Scael.Bx 4.3 . 92