PageRenderTime 45ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 0ms

/Pods/Documentation/CocoaAsyncSocket/html/Protocols/GCDAsyncSocketDelegate.html

https://gitlab.com/mba811/tokaidoapp
HTML | 949 lines | 511 code | 438 blank | 0 comment | 0 complexity | d5ce22474c1c4dab86817ba0319a242a MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="html/html; charset=utf-8" />
  5. <title>GCDAsyncSocketDelegate Protocol Reference</title>
  6. <meta id="xcode-display" name="xcode-display" content="render"/>
  7. <link rel="stylesheet" type="text/css" href="../css/styles.css" media="all" />
  8. <link rel="stylesheet" type="text/css" media="print" href="../css/stylesPrint.css" />
  9. <meta name="generator" content="appledoc 2.1 (build 858)" />
  10. </head>
  11. <body>
  12. <header id="top_header">
  13. <div id="library" class="hideInXcode">
  14. <h1><a id="libraryTitle" href="../index.html">CocoaAsyncSocket 0.0.1 </a></h1>
  15. <a id="developerHome" href="../index.html">Dustin Voss and Robbie Hanson</a>
  16. </div>
  17. <div id="title" role="banner">
  18. <h1 class="hideInXcode">GCDAsyncSocketDelegate Protocol Reference</h1>
  19. </div>
  20. <ul id="headerButtons" role="toolbar">
  21. <li id="toc_button">
  22. <button aria-label="Show Table of Contents" role="checkbox" class="open" id="table_of_contents"><span class="disclosure"></span>Table of Contents</button>
  23. </li>
  24. <li id="jumpto_button" role="navigation">
  25. <select id="jumpTo">
  26. <option value="top">Jump To&#133;</option>
  27. <option value="tasks">Tasks</option>
  28. <option value="instance_methods">Instance Methods</option>
  29. <option value="//api/name/newSocketQueueForConnectionFromAddress:onSocket:">&nbsp;&nbsp;&nbsp;&nbsp;- newSocketQueueForConnectionFromAddress:onSocket:</option>
  30. <option value="//api/name/socket:didAcceptNewSocket:">&nbsp;&nbsp;&nbsp;&nbsp;- socket:didAcceptNewSocket:</option>
  31. <option value="//api/name/socket:didConnectToHost:port:">&nbsp;&nbsp;&nbsp;&nbsp;- socket:didConnectToHost:port:</option>
  32. <option value="//api/name/socket:didReadData:withTag:">&nbsp;&nbsp;&nbsp;&nbsp;- socket:didReadData:withTag:</option>
  33. <option value="//api/name/socket:didReadPartialDataOfLength:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- socket:didReadPartialDataOfLength:tag:</option>
  34. <option value="//api/name/socket:didWriteDataWithTag:">&nbsp;&nbsp;&nbsp;&nbsp;- socket:didWriteDataWithTag:</option>
  35. <option value="//api/name/socket:didWritePartialDataOfLength:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- socket:didWritePartialDataOfLength:tag:</option>
  36. <option value="//api/name/socket:shouldTimeoutReadWithTag:elapsed:bytesDone:">&nbsp;&nbsp;&nbsp;&nbsp;- socket:shouldTimeoutReadWithTag:elapsed:bytesDone:</option>
  37. <option value="//api/name/socket:shouldTimeoutWriteWithTag:elapsed:bytesDone:">&nbsp;&nbsp;&nbsp;&nbsp;- socket:shouldTimeoutWriteWithTag:elapsed:bytesDone:</option>
  38. <option value="//api/name/socketDidCloseReadStream:">&nbsp;&nbsp;&nbsp;&nbsp;- socketDidCloseReadStream:</option>
  39. <option value="//api/name/socketDidDisconnect:withError:">&nbsp;&nbsp;&nbsp;&nbsp;- socketDidDisconnect:withError:</option>
  40. <option value="//api/name/socketDidSecure:">&nbsp;&nbsp;&nbsp;&nbsp;- socketDidSecure:</option>
  41. </select>
  42. </li>
  43. </ul>
  44. </header>
  45. <nav id="tocContainer" class="isShowingTOC">
  46. <ul id="toc" role="tree">
  47. <li role="treeitem" id="task_treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#tasks">Tasks</a></span><ul>
  48. </ul></li>
  49. <li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#instance_methods">Instance Methods</a></span><ul>
  50. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/newSocketQueueForConnectionFromAddress:onSocket:">newSocketQueueForConnectionFromAddress:onSocket:</a></span></li>
  51. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/socket:didAcceptNewSocket:">socket:didAcceptNewSocket:</a></span></li>
  52. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/socket:didConnectToHost:port:">socket:didConnectToHost:port:</a></span></li>
  53. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/socket:didReadData:withTag:">socket:didReadData:withTag:</a></span></li>
  54. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/socket:didReadPartialDataOfLength:tag:">socket:didReadPartialDataOfLength:tag:</a></span></li>
  55. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/socket:didWriteDataWithTag:">socket:didWriteDataWithTag:</a></span></li>
  56. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/socket:didWritePartialDataOfLength:tag:">socket:didWritePartialDataOfLength:tag:</a></span></li>
  57. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/socket:shouldTimeoutReadWithTag:elapsed:bytesDone:">socket:shouldTimeoutReadWithTag:elapsed:bytesDone:</a></span></li>
  58. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/socket:shouldTimeoutWriteWithTag:elapsed:bytesDone:">socket:shouldTimeoutWriteWithTag:elapsed:bytesDone:</a></span></li>
  59. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/socketDidCloseReadStream:">socketDidCloseReadStream:</a></span></li>
  60. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/socketDidDisconnect:withError:">socketDidDisconnect:withError:</a></span></li>
  61. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/socketDidSecure:">socketDidSecure:</a></span></li>
  62. </ul></li>
  63. </ul>
  64. </nav>
  65. <article>
  66. <div id="contents" class="isShowingTOC" role="main">
  67. <a title="GCDAsyncSocketDelegate Protocol Reference" name="top"></a>
  68. <div class="main-navigation navigation-top">
  69. <ul>
  70. <li><a href="../index.html">Index</a></li>
  71. <li><a href="../hierarchy.html">Hierarchy</a></li>
  72. </ul>
  73. </div>
  74. <div id="header">
  75. <div class="section-header">
  76. <h1 class="title title-header">GCDAsyncSocketDelegate Protocol Reference</h1>
  77. </div>
  78. </div>
  79. <div id="container">
  80. <div class="section section-specification"><table cellspacing="0"><tbody>
  81. <tr>
  82. <td class="specification-title">Declared in</td>
  83. <td class="specification-value">GCDAsyncSocket.h</td>
  84. </tr>
  85. </tbody></table></div>
  86. <div class="section section-tasks">
  87. <a title="Tasks" name="tasks"></a>
  88. <h2 class="subtitle subtitle-tasks">Tasks</h2>
  89. <ul class="task-list">
  90. <li>
  91. <span class="tooltip">
  92. <code><a href="#//api/name/newSocketQueueForConnectionFromAddress:onSocket:">&ndash;&nbsp;newSocketQueueForConnectionFromAddress:onSocket:</a></code>
  93. <span class="tooltip"><p>This method is called immediately prior to <a href="#//api/name/socket:didAcceptNewSocket:">socket:didAcceptNewSocket:</a>.<br/>
  94. It optionally allows a listening socket to specify the socketQueue for a new accepted socket.<br/>
  95. If this method is not implemented, or returns NULL, the new accepted socket will create its own default queue.</p></span>
  96. </span>
  97. </li><li>
  98. <span class="tooltip">
  99. <code><a href="#//api/name/socket:didAcceptNewSocket:">&ndash;&nbsp;socket:didAcceptNewSocket:</a></code>
  100. <span class="tooltip"><p>Called when a socket accepts a connection.<br/>
  101. Another socket is automatically spawned to handle it.</p></span>
  102. </span>
  103. </li><li>
  104. <span class="tooltip">
  105. <code><a href="#//api/name/socket:didConnectToHost:port:">&ndash;&nbsp;socket:didConnectToHost:port:</a></code>
  106. <span class="tooltip"><p>Called when a socket connects and is ready for reading and writing.<br/>
  107. The host parameter will be an IP address, not a DNS name.</p></span>
  108. </span>
  109. </li><li>
  110. <span class="tooltip">
  111. <code><a href="#//api/name/socket:didReadData:withTag:">&ndash;&nbsp;socket:didReadData:withTag:</a></code>
  112. <span class="tooltip"><p>Called when a socket has completed reading the requested data into memory.<br/>
  113. Not called if there is an error.</p></span>
  114. </span>
  115. </li><li>
  116. <span class="tooltip">
  117. <code><a href="#//api/name/socket:didReadPartialDataOfLength:tag:">&ndash;&nbsp;socket:didReadPartialDataOfLength:tag:</a></code>
  118. <span class="tooltip"><p>Called when a socket has read in data, but has not yet completed the read.<br/>
  119. This would occur if using readToData: or readToLength: methods.<br/>
  120. It may be used to for things such as updating progress bars.</p></span>
  121. </span>
  122. </li><li>
  123. <span class="tooltip">
  124. <code><a href="#//api/name/socket:didWriteDataWithTag:">&ndash;&nbsp;socket:didWriteDataWithTag:</a></code>
  125. <span class="tooltip"><p>Called when a socket has completed writing the requested data. Not called if there is an error.</p></span>
  126. </span>
  127. </li><li>
  128. <span class="tooltip">
  129. <code><a href="#//api/name/socket:didWritePartialDataOfLength:tag:">&ndash;&nbsp;socket:didWritePartialDataOfLength:tag:</a></code>
  130. <span class="tooltip"><p>Called when a socket has written some data, but has not yet completed the entire write.<br/>
  131. It may be used to for things such as updating progress bars.</p></span>
  132. </span>
  133. </li><li>
  134. <span class="tooltip">
  135. <code><a href="#//api/name/socket:shouldTimeoutReadWithTag:elapsed:bytesDone:">&ndash;&nbsp;socket:shouldTimeoutReadWithTag:elapsed:bytesDone:</a></code>
  136. <span class="tooltip"><p>Called if a read operation has reached its timeout without completing.<br/>
  137. This method allows you to optionally extend the timeout.<br/>
  138. If you return a positive time interval (> 0) the read&rsquo;s timeout will be extended by the given amount.<br/>
  139. If you don&rsquo;t implement this method, or return a non-positive time interval (&lt;= 0) the read will timeout as usual.</p></span>
  140. </span>
  141. </li><li>
  142. <span class="tooltip">
  143. <code><a href="#//api/name/socket:shouldTimeoutWriteWithTag:elapsed:bytesDone:">&ndash;&nbsp;socket:shouldTimeoutWriteWithTag:elapsed:bytesDone:</a></code>
  144. <span class="tooltip"><p>Called if a write operation has reached its timeout without completing.<br/>
  145. This method allows you to optionally extend the timeout.<br/>
  146. If you return a positive time interval (> 0) the write&rsquo;s timeout will be extended by the given amount.<br/>
  147. If you don&rsquo;t implement this method, or return a non-positive time interval (&lt;= 0) the write will timeout as usual.</p></span>
  148. </span>
  149. </li><li>
  150. <span class="tooltip">
  151. <code><a href="#//api/name/socketDidCloseReadStream:">&ndash;&nbsp;socketDidCloseReadStream:</a></code>
  152. <span class="tooltip"><p>Conditionally called if the read stream closes, but the write stream may still be writeable.</p></span>
  153. </span>
  154. </li><li>
  155. <span class="tooltip">
  156. <code><a href="#//api/name/socketDidDisconnect:withError:">&ndash;&nbsp;socketDidDisconnect:withError:</a></code>
  157. <span class="tooltip"><p>Called when a socket disconnects with or without error.</p></span>
  158. </span>
  159. </li><li>
  160. <span class="tooltip">
  161. <code><a href="#//api/name/socketDidSecure:">&ndash;&nbsp;socketDidSecure:</a></code>
  162. <span class="tooltip"><p>Called after the socket has successfully completed SSL/TLS negotiation.<br/>
  163. This method is not called unless you use the provided startTLS method.</p></span>
  164. </span>
  165. </li>
  166. </ul>
  167. </div>
  168. <div class="section section-methods">
  169. <a title="Instance Methods" name="instance_methods"></a>
  170. <h2 class="subtitle subtitle-methods">Instance Methods</h2>
  171. <div class="section-method">
  172. <a name="//api/name/newSocketQueueForConnectionFromAddress:onSocket:" title="newSocketQueueForConnectionFromAddress:onSocket:"></a>
  173. <h3 class="subsubtitle method-title">newSocketQueueForConnectionFromAddress:onSocket:</h3>
  174. <div class="method-subsection brief-description">
  175. <p>This method is called immediately prior to <a href="#//api/name/socket:didAcceptNewSocket:">socket:didAcceptNewSocket:</a>.<br/>
  176. It optionally allows a listening socket to specify the socketQueue for a new accepted socket.<br/>
  177. If this method is not implemented, or returns NULL, the new accepted socket will create its own default queue.</p>
  178. </div>
  179. <div class="method-subsection method-declaration"><code>- (dispatch_queue_t)newSocketQueueForConnectionFromAddress:(NSData *)<em>address</em> onSocket:(GCDAsyncSocket *)<em>sock</em></code></div>
  180. <div class="method-subsection discussion-section">
  181. <h4 class="method-subtitle">Discussion</h4>
  182. <p>This method is called immediately prior to <a href="#//api/name/socket:didAcceptNewSocket:">socket:didAcceptNewSocket:</a>.<br/>
  183. It optionally allows a listening socket to specify the socketQueue for a new accepted socket.<br/>
  184. If this method is not implemented, or returns NULL, the new accepted socket will create its own default queue.</p>
  185. <p>Since you cannot autorelease a dispatch_queue,<br/>
  186. this method uses the &ldquo;new&rdquo; prefix in its name to specify that the returned queue has been retained.</p>
  187. <p>Thus you could do something like this in the implementation:<br/>
  188. return dispatch_queue_create(&ldquo;MyQueue&rdquo;, NULL);</p>
  189. <p>If you are placing multiple sockets on the same queue,<br/>
  190. then care should be taken to increment the retain count each time this method is invoked.</p>
  191. <p>For example, your implementation might look something like this:<br/>
  192. dispatch_retain(myExistingQueue);<br/>
  193. return myExistingQueue;</p>
  194. </div>
  195. <div class="method-subsection declared-in-section">
  196. <h4 class="method-subtitle">Declared In</h4>
  197. <code class="declared-in-ref">GCDAsyncSocket.h</code><br />
  198. </div>
  199. </div>
  200. <div class="section-method">
  201. <a name="//api/name/socket:didAcceptNewSocket:" title="socket:didAcceptNewSocket:"></a>
  202. <h3 class="subsubtitle method-title">socket:didAcceptNewSocket:</h3>
  203. <div class="method-subsection brief-description">
  204. <p>Called when a socket accepts a connection.<br/>
  205. Another socket is automatically spawned to handle it.</p>
  206. </div>
  207. <div class="method-subsection method-declaration"><code>- (void)socket:(GCDAsyncSocket *)<em>sock</em> didAcceptNewSocket:(GCDAsyncSocket *)<em>newSocket</em></code></div>
  208. <div class="method-subsection discussion-section">
  209. <h4 class="method-subtitle">Discussion</h4>
  210. <p>Called when a socket accepts a connection.<br/>
  211. Another socket is automatically spawned to handle it.</p>
  212. <p>You must retain the newSocket if you wish to handle the connection.<br/>
  213. Otherwise the newSocket instance will be released and the spawned connection will be closed.</p>
  214. <p>By default the new socket will have the same delegate and delegateQueue.<br/>
  215. You may, of course, change this at any time.</p>
  216. </div>
  217. <div class="method-subsection declared-in-section">
  218. <h4 class="method-subtitle">Declared In</h4>
  219. <code class="declared-in-ref">GCDAsyncSocket.h</code><br />
  220. </div>
  221. </div>
  222. <div class="section-method">
  223. <a name="//api/name/socket:didConnectToHost:port:" title="socket:didConnectToHost:port:"></a>
  224. <h3 class="subsubtitle method-title">socket:didConnectToHost:port:</h3>
  225. <div class="method-subsection brief-description">
  226. <p>Called when a socket connects and is ready for reading and writing.<br/>
  227. The host parameter will be an IP address, not a DNS name.</p>
  228. </div>
  229. <div class="method-subsection method-declaration"><code>- (void)socket:(GCDAsyncSocket *)<em>sock</em> didConnectToHost:(NSString *)<em>host</em> port:(uint16_t)<em>port</em></code></div>
  230. <div class="method-subsection discussion-section">
  231. <h4 class="method-subtitle">Discussion</h4>
  232. <p>Called when a socket connects and is ready for reading and writing.<br/>
  233. The host parameter will be an IP address, not a DNS name.</p>
  234. </div>
  235. <div class="method-subsection declared-in-section">
  236. <h4 class="method-subtitle">Declared In</h4>
  237. <code class="declared-in-ref">GCDAsyncSocket.h</code><br />
  238. </div>
  239. </div>
  240. <div class="section-method">
  241. <a name="//api/name/socket:didReadData:withTag:" title="socket:didReadData:withTag:"></a>
  242. <h3 class="subsubtitle method-title">socket:didReadData:withTag:</h3>
  243. <div class="method-subsection brief-description">
  244. <p>Called when a socket has completed reading the requested data into memory.<br/>
  245. Not called if there is an error.</p>
  246. </div>
  247. <div class="method-subsection method-declaration"><code>- (void)socket:(GCDAsyncSocket *)<em>sock</em> didReadData:(NSData *)<em>data</em> withTag:(long)<em>tag</em></code></div>
  248. <div class="method-subsection discussion-section">
  249. <h4 class="method-subtitle">Discussion</h4>
  250. <p>Called when a socket has completed reading the requested data into memory.<br/>
  251. Not called if there is an error.</p>
  252. </div>
  253. <div class="method-subsection declared-in-section">
  254. <h4 class="method-subtitle">Declared In</h4>
  255. <code class="declared-in-ref">GCDAsyncSocket.h</code><br />
  256. </div>
  257. </div>
  258. <div class="section-method">
  259. <a name="//api/name/socket:didReadPartialDataOfLength:tag:" title="socket:didReadPartialDataOfLength:tag:"></a>
  260. <h3 class="subsubtitle method-title">socket:didReadPartialDataOfLength:tag:</h3>
  261. <div class="method-subsection brief-description">
  262. <p>Called when a socket has read in data, but has not yet completed the read.<br/>
  263. This would occur if using readToData: or readToLength: methods.<br/>
  264. It may be used to for things such as updating progress bars.</p>
  265. </div>
  266. <div class="method-subsection method-declaration"><code>- (void)socket:(GCDAsyncSocket *)<em>sock</em> didReadPartialDataOfLength:(NSUInteger)<em>partialLength</em> tag:(long)<em>tag</em></code></div>
  267. <div class="method-subsection discussion-section">
  268. <h4 class="method-subtitle">Discussion</h4>
  269. <p>Called when a socket has read in data, but has not yet completed the read.<br/>
  270. This would occur if using readToData: or readToLength: methods.<br/>
  271. It may be used to for things such as updating progress bars.</p>
  272. </div>
  273. <div class="method-subsection declared-in-section">
  274. <h4 class="method-subtitle">Declared In</h4>
  275. <code class="declared-in-ref">GCDAsyncSocket.h</code><br />
  276. </div>
  277. </div>
  278. <div class="section-method">
  279. <a name="//api/name/socket:didWriteDataWithTag:" title="socket:didWriteDataWithTag:"></a>
  280. <h3 class="subsubtitle method-title">socket:didWriteDataWithTag:</h3>
  281. <div class="method-subsection brief-description">
  282. <p>Called when a socket has completed writing the requested data. Not called if there is an error.</p>
  283. </div>
  284. <div class="method-subsection method-declaration"><code>- (void)socket:(GCDAsyncSocket *)<em>sock</em> didWriteDataWithTag:(long)<em>tag</em></code></div>
  285. <div class="method-subsection discussion-section">
  286. <h4 class="method-subtitle">Discussion</h4>
  287. <p>Called when a socket has completed writing the requested data. Not called if there is an error.</p>
  288. </div>
  289. <div class="method-subsection declared-in-section">
  290. <h4 class="method-subtitle">Declared In</h4>
  291. <code class="declared-in-ref">GCDAsyncSocket.h</code><br />
  292. </div>
  293. </div>
  294. <div class="section-method">
  295. <a name="//api/name/socket:didWritePartialDataOfLength:tag:" title="socket:didWritePartialDataOfLength:tag:"></a>
  296. <h3 class="subsubtitle method-title">socket:didWritePartialDataOfLength:tag:</h3>
  297. <div class="method-subsection brief-description">
  298. <p>Called when a socket has written some data, but has not yet completed the entire write.<br/>
  299. It may be used to for things such as updating progress bars.</p>
  300. </div>
  301. <div class="method-subsection method-declaration"><code>- (void)socket:(GCDAsyncSocket *)<em>sock</em> didWritePartialDataOfLength:(NSUInteger)<em>partialLength</em> tag:(long)<em>tag</em></code></div>
  302. <div class="method-subsection discussion-section">
  303. <h4 class="method-subtitle">Discussion</h4>
  304. <p>Called when a socket has written some data, but has not yet completed the entire write.<br/>
  305. It may be used to for things such as updating progress bars.</p>
  306. </div>
  307. <div class="method-subsection declared-in-section">
  308. <h4 class="method-subtitle">Declared In</h4>
  309. <code class="declared-in-ref">GCDAsyncSocket.h</code><br />
  310. </div>
  311. </div>
  312. <div class="section-method">
  313. <a name="//api/name/socket:shouldTimeoutReadWithTag:elapsed:bytesDone:" title="socket:shouldTimeoutReadWithTag:elapsed:bytesDone:"></a>
  314. <h3 class="subsubtitle method-title">socket:shouldTimeoutReadWithTag:elapsed:bytesDone:</h3>
  315. <div class="method-subsection brief-description">
  316. <p>Called if a read operation has reached its timeout without completing.<br/>
  317. This method allows you to optionally extend the timeout.<br/>
  318. If you return a positive time interval (> 0) the read&rsquo;s timeout will be extended by the given amount.<br/>
  319. If you don&rsquo;t implement this method, or return a non-positive time interval (&lt;= 0) the read will timeout as usual.</p>
  320. </div>
  321. <div class="method-subsection method-declaration"><code>- (NSTimeInterval)socket:(GCDAsyncSocket *)<em>sock</em> shouldTimeoutReadWithTag:(long)<em>tag</em> elapsed:(NSTimeInterval)<em>elapsed</em> bytesDone:(NSUInteger)<em>length</em></code></div>
  322. <div class="method-subsection discussion-section">
  323. <h4 class="method-subtitle">Discussion</h4>
  324. <p>Called if a read operation has reached its timeout without completing.<br/>
  325. This method allows you to optionally extend the timeout.<br/>
  326. If you return a positive time interval (> 0) the read&rsquo;s timeout will be extended by the given amount.<br/>
  327. If you don&rsquo;t implement this method, or return a non-positive time interval (&lt;= 0) the read will timeout as usual.</p>
  328. <p>The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method.<br/>
  329. The length parameter is the number of bytes that have been read so far for the read operation.</p>
  330. <p>Note that this method may be called multiple times for a single read if you return positive numbers.</p>
  331. </div>
  332. <div class="method-subsection declared-in-section">
  333. <h4 class="method-subtitle">Declared In</h4>
  334. <code class="declared-in-ref">GCDAsyncSocket.h</code><br />
  335. </div>
  336. </div>
  337. <div class="section-method">
  338. <a name="//api/name/socket:shouldTimeoutWriteWithTag:elapsed:bytesDone:" title="socket:shouldTimeoutWriteWithTag:elapsed:bytesDone:"></a>
  339. <h3 class="subsubtitle method-title">socket:shouldTimeoutWriteWithTag:elapsed:bytesDone:</h3>
  340. <div class="method-subsection brief-description">
  341. <p>Called if a write operation has reached its timeout without completing.<br/>
  342. This method allows you to optionally extend the timeout.<br/>
  343. If you return a positive time interval (> 0) the write&rsquo;s timeout will be extended by the given amount.<br/>
  344. If you don&rsquo;t implement this method, or return a non-positive time interval (&lt;= 0) the write will timeout as usual.</p>
  345. </div>
  346. <div class="method-subsection method-declaration"><code>- (NSTimeInterval)socket:(GCDAsyncSocket *)<em>sock</em> shouldTimeoutWriteWithTag:(long)<em>tag</em> elapsed:(NSTimeInterval)<em>elapsed</em> bytesDone:(NSUInteger)<em>length</em></code></div>
  347. <div class="method-subsection discussion-section">
  348. <h4 class="method-subtitle">Discussion</h4>
  349. <p>Called if a write operation has reached its timeout without completing.<br/>
  350. This method allows you to optionally extend the timeout.<br/>
  351. If you return a positive time interval (> 0) the write&rsquo;s timeout will be extended by the given amount.<br/>
  352. If you don&rsquo;t implement this method, or return a non-positive time interval (&lt;= 0) the write will timeout as usual.</p>
  353. <p>The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method.<br/>
  354. The length parameter is the number of bytes that have been written so far for the write operation.</p>
  355. <p>Note that this method may be called multiple times for a single write if you return positive numbers.</p>
  356. </div>
  357. <div class="method-subsection declared-in-section">
  358. <h4 class="method-subtitle">Declared In</h4>
  359. <code class="declared-in-ref">GCDAsyncSocket.h</code><br />
  360. </div>
  361. </div>
  362. <div class="section-method">
  363. <a name="//api/name/socketDidCloseReadStream:" title="socketDidCloseReadStream:"></a>
  364. <h3 class="subsubtitle method-title">socketDidCloseReadStream:</h3>
  365. <div class="method-subsection brief-description">
  366. <p>Conditionally called if the read stream closes, but the write stream may still be writeable.</p>
  367. </div>
  368. <div class="method-subsection method-declaration"><code>- (void)socketDidCloseReadStream:(GCDAsyncSocket *)<em>sock</em></code></div>
  369. <div class="method-subsection discussion-section">
  370. <h4 class="method-subtitle">Discussion</h4>
  371. <p>Conditionally called if the read stream closes, but the write stream may still be writeable.</p>
  372. <p>This delegate method is only called if autoDisconnectOnClosedReadStream has been set to NO.<br/>
  373. See the discussion on the autoDisconnectOnClosedReadStream method for more information.</p>
  374. </div>
  375. <div class="method-subsection declared-in-section">
  376. <h4 class="method-subtitle">Declared In</h4>
  377. <code class="declared-in-ref">GCDAsyncSocket.h</code><br />
  378. </div>
  379. </div>
  380. <div class="section-method">
  381. <a name="//api/name/socketDidDisconnect:withError:" title="socketDidDisconnect:withError:"></a>
  382. <h3 class="subsubtitle method-title">socketDidDisconnect:withError:</h3>
  383. <div class="method-subsection brief-description">
  384. <p>Called when a socket disconnects with or without error.</p>
  385. </div>
  386. <div class="method-subsection method-declaration"><code>- (void)socketDidDisconnect:(GCDAsyncSocket *)<em>sock</em> withError:(NSError *)<em>err</em></code></div>
  387. <div class="method-subsection discussion-section">
  388. <h4 class="method-subtitle">Discussion</h4>
  389. <p>Called when a socket disconnects with or without error.</p>
  390. <p>If you call the disconnect method, and the socket wasn&rsquo;t already disconnected,<br/>
  391. this delegate method will be called before the disconnect method returns.</p>
  392. </div>
  393. <div class="method-subsection declared-in-section">
  394. <h4 class="method-subtitle">Declared In</h4>
  395. <code class="declared-in-ref">GCDAsyncSocket.h</code><br />
  396. </div>
  397. </div>
  398. <div class="section-method">
  399. <a name="//api/name/socketDidSecure:" title="socketDidSecure:"></a>
  400. <h3 class="subsubtitle method-title">socketDidSecure:</h3>
  401. <div class="method-subsection brief-description">
  402. <p>Called after the socket has successfully completed SSL/TLS negotiation.<br/>
  403. This method is not called unless you use the provided startTLS method.</p>
  404. </div>
  405. <div class="method-subsection method-declaration"><code>- (void)socketDidSecure:(GCDAsyncSocket *)<em>sock</em></code></div>
  406. <div class="method-subsection discussion-section">
  407. <h4 class="method-subtitle">Discussion</h4>
  408. <p>Called after the socket has successfully completed SSL/TLS negotiation.<br/>
  409. This method is not called unless you use the provided startTLS method.</p>
  410. <p>If a SSL/TLS negotiation fails (invalid certificate, etc) then the socket will immediately close,<br/>
  411. and the <a href="#//api/name/socketDidDisconnect:withError:">socketDidDisconnect:withError:</a> delegate method will be called with the specific SSL error code.</p>
  412. </div>
  413. <div class="method-subsection declared-in-section">
  414. <h4 class="method-subtitle">Declared In</h4>
  415. <code class="declared-in-ref">GCDAsyncSocket.h</code><br />
  416. </div>
  417. </div>
  418. </div>
  419. </div>
  420. <div class="main-navigation navigation-bottom">
  421. <ul>
  422. <li><a href="../index.html">Index</a></li>
  423. <li><a href="../hierarchy.html">Hierarchy</a></li>
  424. </ul>
  425. </div>
  426. <div id="footer">
  427. <hr />
  428. <div class="footer-copyright">
  429. <p><span class="copyright">&copy; 2013 Dustin Voss and Robbie Hanson. All rights reserved. (Last updated: 2013-04-24)</span><br />
  430. <span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.1 (build 858)</a>.</span></p>
  431. </div>
  432. </div>
  433. </div>
  434. </article>
  435. <script type="text/javascript">
  436. function jumpToChange()
  437. {
  438. window.location.hash = this.options[this.selectedIndex].value;
  439. }
  440. function toggleTOC()
  441. {
  442. var contents = document.getElementById('contents');
  443. var tocContainer = document.getElementById('tocContainer');
  444. if (this.getAttribute('class') == 'open')
  445. {
  446. this.setAttribute('class', '');
  447. contents.setAttribute('class', '');
  448. tocContainer.setAttribute('class', '');
  449. window.name = "hideTOC";
  450. }
  451. else
  452. {
  453. this.setAttribute('class', 'open');
  454. contents.setAttribute('class', 'isShowingTOC');
  455. tocContainer.setAttribute('class', 'isShowingTOC');
  456. window.name = "";
  457. }
  458. return false;
  459. }
  460. function toggleTOCEntryChildren(e)
  461. {
  462. e.stopPropagation();
  463. var currentClass = this.getAttribute('class');
  464. if (currentClass == 'children') {
  465. this.setAttribute('class', 'children open');
  466. }
  467. else if (currentClass == 'children open') {
  468. this.setAttribute('class', 'children');
  469. }
  470. return false;
  471. }
  472. function tocEntryClick(e)
  473. {
  474. e.stopPropagation();
  475. return true;
  476. }
  477. function init()
  478. {
  479. var selectElement = document.getElementById('jumpTo');
  480. selectElement.addEventListener('change', jumpToChange, false);
  481. var tocButton = document.getElementById('table_of_contents');
  482. tocButton.addEventListener('click', toggleTOC, false);
  483. var taskTreeItem = document.getElementById('task_treeitem');
  484. if (taskTreeItem.getElementsByTagName('li').length > 0)
  485. {
  486. taskTreeItem.setAttribute('class', 'children');
  487. taskTreeItem.firstChild.setAttribute('class', 'disclosure');
  488. }
  489. var tocList = document.getElementById('toc');
  490. var tocEntries = tocList.getElementsByTagName('li');
  491. for (var i = 0; i < tocEntries.length; i++) {
  492. tocEntries[i].addEventListener('click', toggleTOCEntryChildren, false);
  493. }
  494. var tocLinks = tocList.getElementsByTagName('a');
  495. for (var i = 0; i < tocLinks.length; i++) {
  496. tocLinks[i].addEventListener('click', tocEntryClick, false);
  497. }
  498. if (window.name == "hideTOC") {
  499. toggleTOC.call(tocButton);
  500. }
  501. }
  502. window.onload = init;
  503. // If showing in Xcode, hide the TOC and Header
  504. if (navigator.userAgent.match(/xcode/i)) {
  505. document.getElementById("contents").className = "hideInXcode"
  506. document.getElementById("tocContainer").className = "hideInXcode"
  507. document.getElementById("top_header").className = "hideInXcode"
  508. }
  509. </script>
  510. </body>
  511. </html>