Commit | Line | Data |
---|---|---|
089e2666 KM |
1 | .\" Copyright (c) 1983 Regents of the University of California. |
2 | .\" All rights reserved. The Berkeley software License Agreement | |
3 | .\" specifies the terms and conditions for redistribution. | |
4 | .\" | |
1df490e6 | 5 | .\" @(#)ip.4 6.1 (Berkeley) %G% |
089e2666 | 6 | .\" |
1df490e6 | 7 | .TH IP 4P "" |
089e2666 KM |
8 | .UC 5 |
9 | .SH NAME | |
10 | ip \- Internet 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, 0); | |
17 | .SH DESCRIPTION | |
18 | IP is the transport layer protocol used | |
19 | by the Internet protocol family. It may be accessed | |
20 | through a \*(lqraw socket\*(rq when developing new protocols, or | |
21 | special purpose applications. IP sockets are connectionless, | |
22 | and are normally used with the | |
23 | .I sendto | |
24 | and | |
25 | .I recvfrom | |
26 | calls, though the | |
27 | .IR connect (2) | |
28 | call may also be used to fix the destination for future | |
29 | packets (in which case the | |
30 | .IR read (2) | |
31 | or | |
32 | .IR recv (2) | |
33 | and | |
34 | .IR write (2) | |
35 | or | |
36 | .IR send (2) | |
37 | system calls may be used). | |
38 | .PP | |
39 | Outgoing packets automatically have an IP header prepended to | |
40 | them (based on the destination address and the protocol | |
41 | number the socket is created with). | |
42 | Likewise, incoming packets have their IP header stripped | |
43 | before being sent to the user. | |
44 | .SH DIAGNOSTICS | |
45 | A socket operation may fail with one of the following errors returned: | |
46 | .TP 15 | |
47 | [EISCONN] | |
48 | when trying to establish a connection on a socket which | |
49 | already has one, or when trying to send a datagram with the destination | |
50 | address specified and the socket is already connected; | |
51 | .TP 15 | |
52 | [ENOTCONN] | |
53 | when trying to send a datagram, but | |
54 | no destination address is specified, and the socket hasn't been | |
55 | connected; | |
56 | .TP 15 | |
57 | [ENOBUFS] | |
58 | when the system runs out of memory for | |
59 | an internal data structure; | |
60 | .TP 15 | |
61 | [EADDRNOTAVAIL] | |
62 | when an attempt is made to create a | |
63 | socket with a network address for which no network interface | |
64 | exists. | |
65 | .SH SEE ALSO | |
66 | send(2), recv(2), intro(4N), inet(4F) | |
67 | .SH BUGS | |
68 | One should be able to send and receive ip options. | |
69 | .PP | |
70 | The protocol should be settable after socket creation. |