80 unspecified in the \fBbind()\fR call by either active or passive \fBTCP\fR
81 sockets. This feature is usually used if the local address is either unknown or
82 irrelevant. If left unspecified, the local \fBIP\fR or IPv6 address will be
83 bound at connection time to the address of the network interface used to
84 service the connection.
85 .sp
86 .LP
87 Note that no two TCP sockets can be bound to the same port unless the bound IP
88 addresses are different. IPv4 \fBINADDR_ANY\fR and IPv6 unspecified addresses
89 compare as equal to any IPv4 or IPv6 address. For example, if a socket is bound
90 to \fBINADDR_ANY\fR or unspecified address and port X, no other socket can bind
91 to port X, regardless of the binding address. This special consideration of
92 \fBINADDR_ANY\fR and unspecified address can be changed using the socket option
93 \fBSO_REUSEADDR\fR. If \fBSO_REUSEADDR\fR is set on a socket doing a bind, IPv4
94 \fBINADDR_ANY\fR and IPv6 unspecified address do not compare as equal to any IP
95 address. This means that as long as the two sockets are not both bound to
96 \fBINADDR_ANY\fR/unspecified address or the same IP address, the two sockets
97 can be bound to the same port.
98 .sp
99 .LP
100 If an application does not want to allow another socket using the
101 \fBSO_REUSEADDR\fR option to bind to a port its socket is bound to, the
102 application can set the socket level option \fBSO_EXCLBIND\fR on a socket. The
103 option values of 0 and 1 mean enabling and disabling the option respectively.
104 Once this option is enabled on a socket, no other socket can be bound to the
105 same port.
106 .sp
107 .LP
108 Once a connection has been established, data can be exchanged using the
109 \fBread\fR(2) and \fBwrite\fR(2) system calls.
110 .sp
111 .LP
112 Under most circumstances, \fBTCP\fR sends data when it is presented. When
113 outstanding data has not yet been acknowledged, \fBTCP\fR gathers small amounts
114 of output to be sent in a single packet once an acknowledgement has been
115 received. For a small number of clients, such as window systems that send a
116 stream of mouse events which receive no replies, this packetization may cause
117 significant delays. To circumvent this problem, \fBTCP\fR provides a
118 socket-level boolean option, \fBTCP_NODELAY.\fR \fBTCP_NODELAY\fR is defined in
119 \fB<netinet/tcp.h>\fR, and is set with \fBsetsockopt\fR(3SOCKET) and tested
120 with \fBgetsockopt\fR(3SOCKET). The option level for the \fBsetsockopt()\fR
|
80 unspecified in the \fBbind()\fR call by either active or passive \fBTCP\fR
81 sockets. This feature is usually used if the local address is either unknown or
82 irrelevant. If left unspecified, the local \fBIP\fR or IPv6 address will be
83 bound at connection time to the address of the network interface used to
84 service the connection.
85 .sp
86 .LP
87 Note that no two TCP sockets can be bound to the same port unless the bound IP
88 addresses are different. IPv4 \fBINADDR_ANY\fR and IPv6 unspecified addresses
89 compare as equal to any IPv4 or IPv6 address. For example, if a socket is bound
90 to \fBINADDR_ANY\fR or unspecified address and port X, no other socket can bind
91 to port X, regardless of the binding address. This special consideration of
92 \fBINADDR_ANY\fR and unspecified address can be changed using the socket option
93 \fBSO_REUSEADDR\fR. If \fBSO_REUSEADDR\fR is set on a socket doing a bind, IPv4
94 \fBINADDR_ANY\fR and IPv6 unspecified address do not compare as equal to any IP
95 address. This means that as long as the two sockets are not both bound to
96 \fBINADDR_ANY\fR/unspecified address or the same IP address, the two sockets
97 can be bound to the same port.
98 .sp
99 .LP
100 If an application does not want to allow another socket using the
101 \fBSO_REUSEADDR\fR option to bind to a port its socket is bound to, the
102 application can set the socket level option \fBSO_EXCLBIND\fR on a socket. The
103 option values of 0 and 1 mean enabling and disabling the option respectively.
104 Once this option is enabled on a socket, no other socket can be bound to the
105 same port.
106 .sp
107 .LP
108 Once a connection has been established, data can be exchanged using the
109 \fBread\fR(2) and \fBwrite\fR(2) system calls.
110 .sp
111 .LP
112 Under most circumstances, \fBTCP\fR sends data when it is presented. When
113 outstanding data has not yet been acknowledged, \fBTCP\fR gathers small amounts
114 of output to be sent in a single packet once an acknowledgement has been
115 received. For a small number of clients, such as window systems that send a
116 stream of mouse events which receive no replies, this packetization may cause
117 significant delays. To circumvent this problem, \fBTCP\fR provides a
118 socket-level boolean option, \fBTCP_NODELAY.\fR \fBTCP_NODELAY\fR is defined in
119 \fB<netinet/tcp.h>\fR, and is set with \fBsetsockopt\fR(3SOCKET) and tested
120 with \fBgetsockopt\fR(3SOCKET). The option level for the \fBsetsockopt()\fR
|