|
|
1.1 root 1: .TH IP 3
2: .SH NAME
3: ip \- TCP, UDP, IL network protocols over IP
4: .SH SYNOPSIS
5: .nf
6: .B bind -a #Itcp /net
7: .B bind -a #Iudp /net
8: .B bind -a #Iil /net
9:
10: .B /net/tcp/clone
11: .BI /net/tcp/ n
12: .BI /net/tcp/ n /data
13: .BI /net/tcp/ n /ctl
14: .BI /net/tcp/ n /local
15: .BI /net/tcp/ n /remote
16: .BI /net/tcp/ n /status
17: .BI /net/tcp/ n /listen
18: \&...
19: .fi
20: .SH DESCRIPTION
21: The IP device provides the interface for several protocols that
22: run over IP on an Ethernet.
23: TCP and UDP provide the standard Internet
24: protocols for reliable stream and unreliable datagram
25: communication.
26: IL provides a reliable datagram service for communication
27: between Plan 9 machines.
28: IL is the protocol of choice for most Plan 9 services.
29: .PP
30: Each of the protocols is served by the IP device, which represents each
31: connection by a set of device files.
32: The top level directory of each protocol contains a
33: .B clone
34: file and subdirectories numbered from zero to the number of connections
35: configured for this protocol.
36: .PP
37: Opening the
38: .B clone
39: file reserves a connection. The file descriptor returned from the
40: .IR open (2)
41: will point to the control file,
42: .BR ctl ,
43: of the newly allocated connection. Reading the
44: .B ctl
45: file returns a text
46: string representing the number of the
47: connection. Connections may be used either to listen for incoming calls
48: or to initiate calls to other machines.
49: .PP
50: A connection is controlled by writing text strings to the associated
51: .B ctl
52: file. After a connection has been established data may be read from
53: and written to the data file.
54: For the datagram services, IL and UDP, a
55: .B read
56: of less than the length of a datagram will cause
57: the entire datagram to be consumed.
58: Each write to the data file will send a single datagram on the network.
59: The TCP protocol provides a stream connection that does not preserve
60: .BR read / write
61: boundaries.
62: .PP
63: Prior to sending data, remote and local addresses must be set for the connection.
64: For outgoing calls the local port number will be allocated randomly if none is set.
65: Addresses are set by writing control messages to the
66: .B ctl
67: file of the connection.
68: The connection is not established until the data file is opened.
69: For IL and TCP the
70: process will block until the remote host has acknowledged the connection.
71: UDP opens always succeed.
72: .PP
73: The following control messages are supported:
74: .TP
75: .BI connect\ ipaddress ! port [!r]
76: Set the remote IP address and port number for the connection.
77: If the
78: .I r
79: flag
80: is supplied and no local address has been specified the system will allocate
81: a restricted port number (less than 1024) for the connection to allow communication
82: with Unix machines'
83: .B login
84: and
85: .B exec
86: services.
87: .TP
88: .B disconnect
89: (UDP only)
90: Clear the remote address of a UDP connection.
91: .TP
92: .BI announce\ X
93: .I X
94: is a decimal port number or
95: .LR * .
96: Set the local port
97: number to
98: .I X
99: and accept calls to
100: .IR X .
101: If
102: .I X
103: is
104: .LR * ,
105: accept
106: calls for any port that no process has explicitly announced.
107: The local IP address cannot be set.
108: .B Announce
109: fails if the connection is already announced or connnected.
110: .TP
111: .BI bind\ X
112: .I X
113: is a decimal port number or
114: .LR * .
115: Set the local port number to
116: .IR X .
117: This exists to support library emulation
118: of BSD sockets and is not otherwise used.
119: .TP
120: .BI backlog\ n
121: (IL and TCP only)
122: Set the maximum number of pending requests for a given service
123: to
124: .IR n .
125: By default
126: .I n
127: is set to five. If more than
128: .I n
129: connections are pending,
130: further requests for a service will be rejected.
131: .PP
132: Port numbers must be in the range 1 to 32767.
133: If a local port has not been
134: announced prior to a
135: .B connect
136: a local port number will be allocated automatically.
137: Local ports are allocated from 5000 up.
138: .PP
139: Several files report the status of a
140: connection.
141: The
142: .B remote
143: and
144: .B local
145: files contain the IP address and port number for the remote and local side of the
146: connection. The
147: .B status
148: file contains protocol-dependent information to help debug network connections.
149: .PP
150: A process may accept incoming connections by calling
151: .B open
152: on the
153: .B listen
154: file.
155: The
156: .B open
157: will block until a new connection request arrives.
158: Then
159: .B open
160: will return an open file descriptor which points to the control file of the
161: newly accepted connection.
162: This procedure will accept all calls for the
163: given protocol.
164: .SH "SEE ALSO"
165: .IR listen (8),
166: .IR dial (2),
167: .IR ndb (6)
168: .SH SOURCE
169: .B /sys/src/9/port/devip.c
170: .br
171: .B /sys/src/9/port/stil.c
172: .br
173: .B /sys/src/9/port/stip.c
174: .br
175: .B /sys/src/9/port/tcp*.c
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.