@@ -128,39 +128,6 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
128
128
- (void )setDelegate : (id )delegate delegateQueue : (dispatch_queue_t )delegateQueue ;
129
129
- (void )synchronouslySetDelegate : (id )delegate delegateQueue : (dispatch_queue_t )delegateQueue ;
130
130
131
- /* *
132
- * Traditionally sockets are not closed until the conversation is over.
133
- * However, it is technically possible for the remote enpoint to close its write stream.
134
- * Our socket would then be notified that there is no more data to be read,
135
- * but our socket would still be writeable and the remote endpoint could continue to receive our data.
136
- *
137
- * The argument for this confusing functionality stems from the idea that a client could shut down its
138
- * write stream after sending a request to the server, thus notifying the server there are to be no further requests.
139
- * In practice, however, this technique did little to help server developers.
140
- *
141
- * To make matters worse, from a TCP perspective there is no way to tell the difference from a read stream close
142
- * and a full socket close. They both result in the TCP stack receiving a FIN packet. The only way to tell
143
- * is by continuing to write to the socket. If it was only a read stream close, then writes will continue to work.
144
- * Otherwise an error will be occur shortly (when the remote end sends us a RST packet).
145
- *
146
- * In addition to the technical challenges and confusion, many high level socket/stream API's provide
147
- * no support for dealing with the problem. If the read stream is closed, the API immediately declares the
148
- * socket to be closed, and shuts down the write stream as well. In fact, this is what Apple's CFStream API does.
149
- * It might sound like poor design at first, but in fact it simplifies development.
150
- *
151
- * The vast majority of the time if the read stream is closed it's because the remote endpoint closed its socket.
152
- * Thus it actually makes sense to close the socket at this point.
153
- * And in fact this is what most networking developers want and expect to happen.
154
- * However, if you are writing a server that interacts with a plethora of clients,
155
- * you might encounter a client that uses the discouraged technique of shutting down its write stream.
156
- * If this is the case, you can set this property to NO,
157
- * and make use of the socketDidCloseReadStream delegate method.
158
- *
159
- * The default value is YES.
160
- **/
161
- - (BOOL )autoDisconnectOnClosedReadStream ;
162
- - (void )setAutoDisconnectOnClosedReadStream : (BOOL )flag ;
163
-
164
131
/* *
165
132
* By default, both IPv4 and IPv6 are enabled.
166
133
*
@@ -744,6 +711,39 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
744
711
745
712
#pragma mark Advanced
746
713
714
+ /* *
715
+ * Traditionally sockets are not closed until the conversation is over.
716
+ * However, it is technically possible for the remote enpoint to close its write stream.
717
+ * Our socket would then be notified that there is no more data to be read,
718
+ * but our socket would still be writeable and the remote endpoint could continue to receive our data.
719
+ *
720
+ * The argument for this confusing functionality stems from the idea that a client could shut down its
721
+ * write stream after sending a request to the server, thus notifying the server there are to be no further requests.
722
+ * In practice, however, this technique did little to help server developers.
723
+ *
724
+ * To make matters worse, from a TCP perspective there is no way to tell the difference from a read stream close
725
+ * and a full socket close. They both result in the TCP stack receiving a FIN packet. The only way to tell
726
+ * is by continuing to write to the socket. If it was only a read stream close, then writes will continue to work.
727
+ * Otherwise an error will be occur shortly (when the remote end sends us a RST packet).
728
+ *
729
+ * In addition to the technical challenges and confusion, many high level socket/stream API's provide
730
+ * no support for dealing with the problem. If the read stream is closed, the API immediately declares the
731
+ * socket to be closed, and shuts down the write stream as well. In fact, this is what Apple's CFStream API does.
732
+ * It might sound like poor design at first, but in fact it simplifies development.
733
+ *
734
+ * The vast majority of the time if the read stream is closed it's because the remote endpoint closed its socket.
735
+ * Thus it actually makes sense to close the socket at this point.
736
+ * And in fact this is what most networking developers want and expect to happen.
737
+ * However, if you are writing a server that interacts with a plethora of clients,
738
+ * you might encounter a client that uses the discouraged technique of shutting down its write stream.
739
+ * If this is the case, you can set this property to NO,
740
+ * and make use of the socketDidCloseReadStream delegate method.
741
+ *
742
+ * The default value is YES.
743
+ **/
744
+ - (BOOL )autoDisconnectOnClosedReadStream ;
745
+ - (void )setAutoDisconnectOnClosedReadStream : (BOOL )flag ;
746
+
747
747
/* *
748
748
* It's not thread-safe to access certain variables from outside the socket's internal queue.
749
749
*
0 commit comments