PageRenderTime 43ms CodeModel.GetById 8ms RepoModel.GetById 0ms app.codeStats 0ms

/Pods/Documentation/CocoaAsyncSocket/docset/Contents/Resources/Documents/Protocols/AsyncSocketDelegate.html

https://gitlab.com/mba811/tokaidoapp
HTML | 998 lines | 536 code | 462 blank | 0 comment | 0 complexity | 9066c9d118ef1a50657871aea42c6e39 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>AsyncSocketDelegate 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">AsyncSocketDelegate 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/onSocket:didAcceptNewSocket:">&nbsp;&nbsp;&nbsp;&nbsp;- onSocket:didAcceptNewSocket:</option>
  30. <option value="//api/name/onSocket:didConnectToHost:port:">&nbsp;&nbsp;&nbsp;&nbsp;- onSocket:didConnectToHost:port:</option>
  31. <option value="//api/name/onSocket:didReadData:withTag:">&nbsp;&nbsp;&nbsp;&nbsp;- onSocket:didReadData:withTag:</option>
  32. <option value="//api/name/onSocket:didReadPartialDataOfLength:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- onSocket:didReadPartialDataOfLength:tag:</option>
  33. <option value="//api/name/onSocket:didWriteDataWithTag:">&nbsp;&nbsp;&nbsp;&nbsp;- onSocket:didWriteDataWithTag:</option>
  34. <option value="//api/name/onSocket:didWritePartialDataOfLength:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- onSocket:didWritePartialDataOfLength:tag:</option>
  35. <option value="//api/name/onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:">&nbsp;&nbsp;&nbsp;&nbsp;- onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:</option>
  36. <option value="//api/name/onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:">&nbsp;&nbsp;&nbsp;&nbsp;- onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:</option>
  37. <option value="//api/name/onSocket:wantsRunLoopForNewSocket:">&nbsp;&nbsp;&nbsp;&nbsp;- onSocket:wantsRunLoopForNewSocket:</option>
  38. <option value="//api/name/onSocket:willDisconnectWithError:">&nbsp;&nbsp;&nbsp;&nbsp;- onSocket:willDisconnectWithError:</option>
  39. <option value="//api/name/onSocketDidDisconnect:">&nbsp;&nbsp;&nbsp;&nbsp;- onSocketDidDisconnect:</option>
  40. <option value="//api/name/onSocketDidSecure:">&nbsp;&nbsp;&nbsp;&nbsp;- onSocketDidSecure:</option>
  41. <option value="//api/name/onSocketWillConnect:">&nbsp;&nbsp;&nbsp;&nbsp;- onSocketWillConnect:</option>
  42. </select>
  43. </li>
  44. </ul>
  45. </header>
  46. <nav id="tocContainer" class="isShowingTOC">
  47. <ul id="toc" role="tree">
  48. <li role="treeitem" id="task_treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#tasks">Tasks</a></span><ul>
  49. </ul></li>
  50. <li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#instance_methods">Instance Methods</a></span><ul>
  51. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:didAcceptNewSocket:">onSocket:didAcceptNewSocket:</a></span></li>
  52. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:didConnectToHost:port:">onSocket:didConnectToHost:port:</a></span></li>
  53. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:didReadData:withTag:">onSocket:didReadData:withTag:</a></span></li>
  54. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:didReadPartialDataOfLength:tag:">onSocket:didReadPartialDataOfLength:tag:</a></span></li>
  55. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:didWriteDataWithTag:">onSocket:didWriteDataWithTag:</a></span></li>
  56. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:didWritePartialDataOfLength:tag:">onSocket:didWritePartialDataOfLength:tag:</a></span></li>
  57. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:">onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:</a></span></li>
  58. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:">onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:</a></span></li>
  59. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:wantsRunLoopForNewSocket:">onSocket:wantsRunLoopForNewSocket:</a></span></li>
  60. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:willDisconnectWithError:">onSocket:willDisconnectWithError:</a></span></li>
  61. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocketDidDisconnect:">onSocketDidDisconnect:</a></span></li>
  62. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocketDidSecure:">onSocketDidSecure:</a></span></li>
  63. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocketWillConnect:">onSocketWillConnect:</a></span></li>
  64. </ul></li>
  65. </ul>
  66. </nav>
  67. <article>
  68. <div id="contents" class="isShowingTOC" role="main">
  69. <a title="AsyncSocketDelegate Protocol Reference" name="top"></a>
  70. <div class="main-navigation navigation-top">
  71. <ul>
  72. <li><a href="../index.html">Index</a></li>
  73. <li><a href="../hierarchy.html">Hierarchy</a></li>
  74. </ul>
  75. </div>
  76. <div id="header">
  77. <div class="section-header">
  78. <h1 class="title title-header">AsyncSocketDelegate Protocol Reference</h1>
  79. </div>
  80. </div>
  81. <div id="container">
  82. <div class="section section-specification"><table cellspacing="0"><tbody>
  83. <tr>
  84. <td class="specification-title">Declared in</td>
  85. <td class="specification-value">AsyncSocket.h</td>
  86. </tr>
  87. </tbody></table></div>
  88. <div class="section section-tasks">
  89. <a title="Tasks" name="tasks"></a>
  90. <h2 class="subtitle subtitle-tasks">Tasks</h2>
  91. <ul class="task-list">
  92. <li>
  93. <span class="tooltip">
  94. <code><a href="#//api/name/onSocket:willDisconnectWithError:">&ndash;&nbsp;onSocket:willDisconnectWithError:</a></code>
  95. <span class="tooltip"><p>In the event of an error, the socket is closed.<br/>
  96. You may call &ldquo;unreadData&rdquo; during this call-back to get the last bit of data off the socket.<br/>
  97. When connecting, this delegate method may be called<br/>
  98. before"onSocket:didAcceptNewSocket:&ldquo; or "onSocket:didConnectToHost:&rdquo;.</p></span>
  99. </span>
  100. </li><li>
  101. <span class="tooltip">
  102. <code><a href="#//api/name/onSocketDidDisconnect:">&ndash;&nbsp;onSocketDidDisconnect:</a></code>
  103. <span class="tooltip"><p>Called when a socket disconnects with or without error. If you want to release a socket after it disconnects,<br/>
  104. do so here. It is not safe to do that during &ldquo;onSocket:willDisconnectWithError:&rdquo;.</p></span>
  105. </span>
  106. </li><li>
  107. <span class="tooltip">
  108. <code><a href="#//api/name/onSocket:didAcceptNewSocket:">&ndash;&nbsp;onSocket:didAcceptNewSocket:</a></code>
  109. <span class="tooltip"><p>Called when a socket accepts a connection. Another socket is spawned to handle it. The new socket will have<br/>
  110. the same delegate and will call &ldquo;onSocket:didConnectToHost:port:&rdquo;.</p></span>
  111. </span>
  112. </li><li>
  113. <span class="tooltip">
  114. <code><a href="#//api/name/onSocket:wantsRunLoopForNewSocket:">&ndash;&nbsp;onSocket:wantsRunLoopForNewSocket:</a></code>
  115. <span class="tooltip"><p>Called when a new socket is spawned to handle a connection. This method should return the run-loop of the<br/>
  116. thread on which the new socket and its delegate should operate. If omitted, [NSRunLoop currentRunLoop] is used.</p></span>
  117. </span>
  118. </li><li>
  119. <span class="tooltip">
  120. <code><a href="#//api/name/onSocketWillConnect:">&ndash;&nbsp;onSocketWillConnect:</a></code>
  121. <span class="tooltip"><p>Called when a socket is about to connect. This method should return YES to continue, or NO to abort.<br/>
  122. If aborted, will result in AsyncSocketCanceledError.</p></span>
  123. </span>
  124. </li><li>
  125. <span class="tooltip">
  126. <code><a href="#//api/name/onSocket:didConnectToHost:port:">&ndash;&nbsp;onSocket:didConnectToHost:port:</a></code>
  127. <span class="tooltip"><p>Called when a socket connects and is ready for reading and writing.<br/>
  128. The host parameter will be an IP address, not a DNS name.</p></span>
  129. </span>
  130. </li><li>
  131. <span class="tooltip">
  132. <code><a href="#//api/name/onSocket:didReadData:withTag:">&ndash;&nbsp;onSocket:didReadData:withTag:</a></code>
  133. <span class="tooltip"><p>Called when a socket has completed reading the requested data into memory.<br/>
  134. Not called if there is an error.</p></span>
  135. </span>
  136. </li><li>
  137. <span class="tooltip">
  138. <code><a href="#//api/name/onSocket:didReadPartialDataOfLength:tag:">&ndash;&nbsp;onSocket:didReadPartialDataOfLength:tag:</a></code>
  139. <span class="tooltip"><p>Called when a socket has read in data, but has not yet completed the read.<br/>
  140. This would occur if using readToData: or readToLength: methods.<br/>
  141. It may be used to for things such as updating progress bars.</p></span>
  142. </span>
  143. </li><li>
  144. <span class="tooltip">
  145. <code><a href="#//api/name/onSocket:didWriteDataWithTag:">&ndash;&nbsp;onSocket:didWriteDataWithTag:</a></code>
  146. <span class="tooltip"><p>Called when a socket has completed writing the requested data. Not called if there is an error.</p></span>
  147. </span>
  148. </li><li>
  149. <span class="tooltip">
  150. <code><a href="#//api/name/onSocket:didWritePartialDataOfLength:tag:">&ndash;&nbsp;onSocket:didWritePartialDataOfLength:tag:</a></code>
  151. <span class="tooltip"><p>Called when a socket has written some data, but has not yet completed the entire write.<br/>
  152. It may be used to for things such as updating progress bars.</p></span>
  153. </span>
  154. </li><li>
  155. <span class="tooltip">
  156. <code><a href="#//api/name/onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:">&ndash;&nbsp;onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:</a></code>
  157. <span class="tooltip"><p>Called if a read operation has reached its timeout without completing.<br/>
  158. This method allows you to optionally extend the timeout.<br/>
  159. If you return a positive time interval (> 0) the read&rsquo;s timeout will be extended by the given amount.<br/>
  160. 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>
  161. </span>
  162. </li><li>
  163. <span class="tooltip">
  164. <code><a href="#//api/name/onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:">&ndash;&nbsp;onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:</a></code>
  165. <span class="tooltip"><p>Called if a write operation has reached its timeout without completing.<br/>
  166. This method allows you to optionally extend the timeout.<br/>
  167. If you return a positive time interval (> 0) the write&rsquo;s timeout will be extended by the given amount.<br/>
  168. 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>
  169. </span>
  170. </li><li>
  171. <span class="tooltip">
  172. <code><a href="#//api/name/onSocketDidSecure:">&ndash;&nbsp;onSocketDidSecure:</a></code>
  173. <span class="tooltip"><p>Called after the socket has successfully completed SSL/TLS negotiation.<br/>
  174. This method is not called unless you use the provided startTLS method.</p></span>
  175. </span>
  176. </li>
  177. </ul>
  178. </div>
  179. <div class="section section-methods">
  180. <a title="Instance Methods" name="instance_methods"></a>
  181. <h2 class="subtitle subtitle-methods">Instance Methods</h2>
  182. <div class="section-method">
  183. <a name="//api/name/onSocket:didAcceptNewSocket:" title="onSocket:didAcceptNewSocket:"></a>
  184. <h3 class="subsubtitle method-title">onSocket:didAcceptNewSocket:</h3>
  185. <div class="method-subsection brief-description">
  186. <p>Called when a socket accepts a connection. Another socket is spawned to handle it. The new socket will have<br/>
  187. the same delegate and will call &ldquo;onSocket:didConnectToHost:port:&rdquo;.</p>
  188. </div>
  189. <div class="method-subsection method-declaration"><code>- (void)onSocket:(AsyncSocket *)<em>sock</em> didAcceptNewSocket:(AsyncSocket *)<em>newSocket</em></code></div>
  190. <div class="method-subsection discussion-section">
  191. <h4 class="method-subtitle">Discussion</h4>
  192. <p>Called when a socket accepts a connection. Another socket is spawned to handle it. The new socket will have<br/>
  193. the same delegate and will call &ldquo;onSocket:didConnectToHost:port:&rdquo;.</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">AsyncSocket.h</code><br />
  198. </div>
  199. </div>
  200. <div class="section-method">
  201. <a name="//api/name/onSocket:didConnectToHost:port:" title="onSocket:didConnectToHost:port:"></a>
  202. <h3 class="subsubtitle method-title">onSocket:didConnectToHost:port:</h3>
  203. <div class="method-subsection brief-description">
  204. <p>Called when a socket connects and is ready for reading and writing.<br/>
  205. The host parameter will be an IP address, not a DNS name.</p>
  206. </div>
  207. <div class="method-subsection method-declaration"><code>- (void)onSocket:(AsyncSocket *)<em>sock</em> didConnectToHost:(NSString *)<em>host</em> port:(UInt16)<em>port</em></code></div>
  208. <div class="method-subsection discussion-section">
  209. <h4 class="method-subtitle">Discussion</h4>
  210. <p>Called when a socket connects and is ready for reading and writing.<br/>
  211. The host parameter will be an IP address, not a DNS name.</p>
  212. </div>
  213. <div class="method-subsection declared-in-section">
  214. <h4 class="method-subtitle">Declared In</h4>
  215. <code class="declared-in-ref">AsyncSocket.h</code><br />
  216. </div>
  217. </div>
  218. <div class="section-method">
  219. <a name="//api/name/onSocket:didReadData:withTag:" title="onSocket:didReadData:withTag:"></a>
  220. <h3 class="subsubtitle method-title">onSocket:didReadData:withTag:</h3>
  221. <div class="method-subsection brief-description">
  222. <p>Called when a socket has completed reading the requested data into memory.<br/>
  223. Not called if there is an error.</p>
  224. </div>
  225. <div class="method-subsection method-declaration"><code>- (void)onSocket:(AsyncSocket *)<em>sock</em> didReadData:(NSData *)<em>data</em> withTag:(long)<em>tag</em></code></div>
  226. <div class="method-subsection discussion-section">
  227. <h4 class="method-subtitle">Discussion</h4>
  228. <p>Called when a socket has completed reading the requested data into memory.<br/>
  229. Not called if there is an error.</p>
  230. </div>
  231. <div class="method-subsection declared-in-section">
  232. <h4 class="method-subtitle">Declared In</h4>
  233. <code class="declared-in-ref">AsyncSocket.h</code><br />
  234. </div>
  235. </div>
  236. <div class="section-method">
  237. <a name="//api/name/onSocket:didReadPartialDataOfLength:tag:" title="onSocket:didReadPartialDataOfLength:tag:"></a>
  238. <h3 class="subsubtitle method-title">onSocket:didReadPartialDataOfLength:tag:</h3>
  239. <div class="method-subsection brief-description">
  240. <p>Called when a socket has read in data, but has not yet completed the read.<br/>
  241. This would occur if using readToData: or readToLength: methods.<br/>
  242. It may be used to for things such as updating progress bars.</p>
  243. </div>
  244. <div class="method-subsection method-declaration"><code>- (void)onSocket:(AsyncSocket *)<em>sock</em> didReadPartialDataOfLength:(NSUInteger)<em>partialLength</em> tag:(long)<em>tag</em></code></div>
  245. <div class="method-subsection discussion-section">
  246. <h4 class="method-subtitle">Discussion</h4>
  247. <p>Called when a socket has read in data, but has not yet completed the read.<br/>
  248. This would occur if using readToData: or readToLength: methods.<br/>
  249. It may be used to for things such as updating progress bars.</p>
  250. </div>
  251. <div class="method-subsection declared-in-section">
  252. <h4 class="method-subtitle">Declared In</h4>
  253. <code class="declared-in-ref">AsyncSocket.h</code><br />
  254. </div>
  255. </div>
  256. <div class="section-method">
  257. <a name="//api/name/onSocket:didWriteDataWithTag:" title="onSocket:didWriteDataWithTag:"></a>
  258. <h3 class="subsubtitle method-title">onSocket:didWriteDataWithTag:</h3>
  259. <div class="method-subsection brief-description">
  260. <p>Called when a socket has completed writing the requested data. Not called if there is an error.</p>
  261. </div>
  262. <div class="method-subsection method-declaration"><code>- (void)onSocket:(AsyncSocket *)<em>sock</em> didWriteDataWithTag:(long)<em>tag</em></code></div>
  263. <div class="method-subsection discussion-section">
  264. <h4 class="method-subtitle">Discussion</h4>
  265. <p>Called when a socket has completed writing the requested data. Not called if there is an error.</p>
  266. </div>
  267. <div class="method-subsection declared-in-section">
  268. <h4 class="method-subtitle">Declared In</h4>
  269. <code class="declared-in-ref">AsyncSocket.h</code><br />
  270. </div>
  271. </div>
  272. <div class="section-method">
  273. <a name="//api/name/onSocket:didWritePartialDataOfLength:tag:" title="onSocket:didWritePartialDataOfLength:tag:"></a>
  274. <h3 class="subsubtitle method-title">onSocket:didWritePartialDataOfLength:tag:</h3>
  275. <div class="method-subsection brief-description">
  276. <p>Called when a socket has written some data, but has not yet completed the entire write.<br/>
  277. It may be used to for things such as updating progress bars.</p>
  278. </div>
  279. <div class="method-subsection method-declaration"><code>- (void)onSocket:(AsyncSocket *)<em>sock</em> didWritePartialDataOfLength:(NSUInteger)<em>partialLength</em> tag:(long)<em>tag</em></code></div>
  280. <div class="method-subsection discussion-section">
  281. <h4 class="method-subtitle">Discussion</h4>
  282. <p>Called when a socket has written some data, but has not yet completed the entire write.<br/>
  283. It may be used to for things such as updating progress bars.</p>
  284. </div>
  285. <div class="method-subsection declared-in-section">
  286. <h4 class="method-subtitle">Declared In</h4>
  287. <code class="declared-in-ref">AsyncSocket.h</code><br />
  288. </div>
  289. </div>
  290. <div class="section-method">
  291. <a name="//api/name/onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:" title="onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:"></a>
  292. <h3 class="subsubtitle method-title">onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:</h3>
  293. <div class="method-subsection brief-description">
  294. <p>Called if a read operation has reached its timeout without completing.<br/>
  295. This method allows you to optionally extend the timeout.<br/>
  296. If you return a positive time interval (> 0) the read&rsquo;s timeout will be extended by the given amount.<br/>
  297. If you don&rsquo;t implement this method, or return a non-positive time interval (&lt;= 0) the read will timeout as usual.</p>
  298. </div>
  299. <div class="method-subsection method-declaration"><code>- (NSTimeInterval)onSocket:(AsyncSocket *)<em>sock</em> shouldTimeoutReadWithTag:(long)<em>tag</em> elapsed:(NSTimeInterval)<em>elapsed</em> bytesDone:(NSUInteger)<em>length</em></code></div>
  300. <div class="method-subsection discussion-section">
  301. <h4 class="method-subtitle">Discussion</h4>
  302. <p>Called if a read operation has reached its timeout without completing.<br/>
  303. This method allows you to optionally extend the timeout.<br/>
  304. If you return a positive time interval (> 0) the read&rsquo;s timeout will be extended by the given amount.<br/>
  305. If you don&rsquo;t implement this method, or return a non-positive time interval (&lt;= 0) the read will timeout as usual.</p>
  306. <p>The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method.<br/>
  307. The length parameter is the number of bytes that have been read so far for the read operation.</p>
  308. <p>Note that this method may be called multiple times for a single read if you return positive numbers.</p>
  309. </div>
  310. <div class="method-subsection declared-in-section">
  311. <h4 class="method-subtitle">Declared In</h4>
  312. <code class="declared-in-ref">AsyncSocket.h</code><br />
  313. </div>
  314. </div>
  315. <div class="section-method">
  316. <a name="//api/name/onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:" title="onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:"></a>
  317. <h3 class="subsubtitle method-title">onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:</h3>
  318. <div class="method-subsection brief-description">
  319. <p>Called if a write operation has reached its timeout without completing.<br/>
  320. This method allows you to optionally extend the timeout.<br/>
  321. If you return a positive time interval (> 0) the write&rsquo;s timeout will be extended by the given amount.<br/>
  322. If you don&rsquo;t implement this method, or return a non-positive time interval (&lt;= 0) the write will timeout as usual.</p>
  323. </div>
  324. <div class="method-subsection method-declaration"><code>- (NSTimeInterval)onSocket:(AsyncSocket *)<em>sock</em> shouldTimeoutWriteWithTag:(long)<em>tag</em> elapsed:(NSTimeInterval)<em>elapsed</em> bytesDone:(NSUInteger)<em>length</em></code></div>
  325. <div class="method-subsection discussion-section">
  326. <h4 class="method-subtitle">Discussion</h4>
  327. <p>Called if a write operation has reached its timeout without completing.<br/>
  328. This method allows you to optionally extend the timeout.<br/>
  329. If you return a positive time interval (> 0) the write&rsquo;s timeout will be extended by the given amount.<br/>
  330. If you don&rsquo;t implement this method, or return a non-positive time interval (&lt;= 0) the write will timeout as usual.</p>
  331. <p>The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method.<br/>
  332. The length parameter is the number of bytes that have been written so far for the write operation.</p>
  333. <p>Note that this method may be called multiple times for a single write if you return positive numbers.</p>
  334. </div>
  335. <div class="method-subsection declared-in-section">
  336. <h4 class="method-subtitle">Declared In</h4>
  337. <code class="declared-in-ref">AsyncSocket.h</code><br />
  338. </div>
  339. </div>
  340. <div class="section-method">
  341. <a name="//api/name/onSocket:wantsRunLoopForNewSocket:" title="onSocket:wantsRunLoopForNewSocket:"></a>
  342. <h3 class="subsubtitle method-title">onSocket:wantsRunLoopForNewSocket:</h3>
  343. <div class="method-subsection brief-description">
  344. <p>Called when a new socket is spawned to handle a connection. This method should return the run-loop of the<br/>
  345. thread on which the new socket and its delegate should operate. If omitted, [NSRunLoop currentRunLoop] is used.</p>
  346. </div>
  347. <div class="method-subsection method-declaration"><code>- (NSRunLoop *)onSocket:(AsyncSocket *)<em>sock</em> wantsRunLoopForNewSocket:(AsyncSocket *)<em>newSocket</em></code></div>
  348. <div class="method-subsection discussion-section">
  349. <h4 class="method-subtitle">Discussion</h4>
  350. <p>Called when a new socket is spawned to handle a connection. This method should return the run-loop of the<br/>
  351. thread on which the new socket and its delegate should operate. If omitted, [NSRunLoop currentRunLoop] is used.</p>
  352. </div>
  353. <div class="method-subsection declared-in-section">
  354. <h4 class="method-subtitle">Declared In</h4>
  355. <code class="declared-in-ref">AsyncSocket.h</code><br />
  356. </div>
  357. </div>
  358. <div class="section-method">
  359. <a name="//api/name/onSocket:willDisconnectWithError:" title="onSocket:willDisconnectWithError:"></a>
  360. <h3 class="subsubtitle method-title">onSocket:willDisconnectWithError:</h3>
  361. <div class="method-subsection brief-description">
  362. <p>In the event of an error, the socket is closed.<br/>
  363. You may call &ldquo;unreadData&rdquo; during this call-back to get the last bit of data off the socket.<br/>
  364. When connecting, this delegate method may be called<br/>
  365. before"onSocket:didAcceptNewSocket:&ldquo; or "onSocket:didConnectToHost:&rdquo;.</p>
  366. </div>
  367. <div class="method-subsection method-declaration"><code>- (void)onSocket:(AsyncSocket *)<em>sock</em> willDisconnectWithError:(NSError *)<em>err</em></code></div>
  368. <div class="method-subsection discussion-section">
  369. <h4 class="method-subtitle">Discussion</h4>
  370. <p>In the event of an error, the socket is closed.<br/>
  371. You may call &ldquo;unreadData&rdquo; during this call-back to get the last bit of data off the socket.<br/>
  372. When connecting, this delegate method may be called<br/>
  373. before"onSocket:didAcceptNewSocket:&ldquo; or "onSocket:didConnectToHost:&rdquo;.</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">AsyncSocket.h</code><br />
  378. </div>
  379. </div>
  380. <div class="section-method">
  381. <a name="//api/name/onSocketDidDisconnect:" title="onSocketDidDisconnect:"></a>
  382. <h3 class="subsubtitle method-title">onSocketDidDisconnect:</h3>
  383. <div class="method-subsection brief-description">
  384. <p>Called when a socket disconnects with or without error. If you want to release a socket after it disconnects,<br/>
  385. do so here. It is not safe to do that during &ldquo;onSocket:willDisconnectWithError:&rdquo;.</p>
  386. </div>
  387. <div class="method-subsection method-declaration"><code>- (void)onSocketDidDisconnect:(AsyncSocket *)<em>sock</em></code></div>
  388. <div class="method-subsection discussion-section">
  389. <h4 class="method-subtitle">Discussion</h4>
  390. <p>Called when a socket disconnects with or without error. If you want to release a socket after it disconnects,<br/>
  391. do so here. It is not safe to do that during &ldquo;onSocket:willDisconnectWithError:&rdquo;.</p>
  392. <p>If you call the disconnect method, and the socket wasn&rsquo;t already disconnected,<br/>
  393. this delegate method will be called before the disconnect method returns.</p>
  394. </div>
  395. <div class="method-subsection declared-in-section">
  396. <h4 class="method-subtitle">Declared In</h4>
  397. <code class="declared-in-ref">AsyncSocket.h</code><br />
  398. </div>
  399. </div>
  400. <div class="section-method">
  401. <a name="//api/name/onSocketDidSecure:" title="onSocketDidSecure:"></a>
  402. <h3 class="subsubtitle method-title">onSocketDidSecure:</h3>
  403. <div class="method-subsection brief-description">
  404. <p>Called after the socket has successfully completed SSL/TLS negotiation.<br/>
  405. This method is not called unless you use the provided startTLS method.</p>
  406. </div>
  407. <div class="method-subsection method-declaration"><code>- (void)onSocketDidSecure:(AsyncSocket *)<em>sock</em></code></div>
  408. <div class="method-subsection discussion-section">
  409. <h4 class="method-subtitle">Discussion</h4>
  410. <p>Called after the socket has successfully completed SSL/TLS negotiation.<br/>
  411. This method is not called unless you use the provided startTLS method.</p>
  412. <p>If a SSL/TLS negotiation fails (invalid certificate, etc) then the socket will immediately close,<br/>
  413. and the <a href="#//api/name/onSocket:willDisconnectWithError:">onSocket:willDisconnectWithError:</a> delegate method will be called with the specific SSL error code.</p>
  414. </div>
  415. <div class="method-subsection declared-in-section">
  416. <h4 class="method-subtitle">Declared In</h4>
  417. <code class="declared-in-ref">AsyncSocket.h</code><br />
  418. </div>
  419. </div>
  420. <div class="section-method">
  421. <a name="//api/name/onSocketWillConnect:" title="onSocketWillConnect:"></a>
  422. <h3 class="subsubtitle method-title">onSocketWillConnect:</h3>
  423. <div class="method-subsection brief-description">
  424. <p>Called when a socket is about to connect. This method should return YES to continue, or NO to abort.<br/>
  425. If aborted, will result in AsyncSocketCanceledError.</p>
  426. </div>
  427. <div class="method-subsection method-declaration"><code>- (BOOL)onSocketWillConnect:(AsyncSocket *)<em>sock</em></code></div>
  428. <div class="method-subsection discussion-section">
  429. <h4 class="method-subtitle">Discussion</h4>
  430. <p>Called when a socket is about to connect. This method should return YES to continue, or NO to abort.<br/>
  431. If aborted, will result in AsyncSocketCanceledError.</p>
  432. <p>If the connectToHost:onPort:error: method was called, the delegate will be able to access and configure the<br/>
  433. CFReadStream and CFWriteStream as desired prior to connection.</p>
  434. <p>If the connectToAddress:error: method was called, the delegate will be able to access and configure the<br/>
  435. CFSocket and CFSocketNativeHandle (BSD socket) as desired prior to connection. You will be able to access and<br/>
  436. configure the CFReadStream and CFWriteStream in the <a href="#//api/name/onSocket:didConnectToHost:port:">onSocket:didConnectToHost:port:</a> method.</p>
  437. </div>
  438. <div class="method-subsection declared-in-section">
  439. <h4 class="method-subtitle">Declared In</h4>
  440. <code class="declared-in-ref">AsyncSocket.h</code><br />
  441. </div>
  442. </div>
  443. </div>
  444. </div>
  445. <div class="main-navigation navigation-bottom">
  446. <ul>
  447. <li><a href="../index.html">Index</a></li>
  448. <li><a href="../hierarchy.html">Hierarchy</a></li>
  449. </ul>
  450. </div>
  451. <div id="footer">
  452. <hr />
  453. <div class="footer-copyright">
  454. <p><span class="copyright">&copy; 2013 Dustin Voss and Robbie Hanson. All rights reserved. (Last updated: 2013-04-24)</span><br />
  455. <span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.1 (build 858)</a>.</span></p>
  456. </div>
  457. </div>
  458. </div>
  459. </article>
  460. <script type="text/javascript">
  461. function jumpToChange()
  462. {
  463. window.location.hash = this.options[this.selectedIndex].value;
  464. }
  465. function toggleTOC()
  466. {
  467. var contents = document.getElementById('contents');
  468. var tocContainer = document.getElementById('tocContainer');
  469. if (this.getAttribute('class') == 'open')
  470. {
  471. this.setAttribute('class', '');
  472. contents.setAttribute('class', '');
  473. tocContainer.setAttribute('class', '');
  474. window.name = "hideTOC";
  475. }
  476. else
  477. {
  478. this.setAttribute('class', 'open');
  479. contents.setAttribute('class', 'isShowingTOC');
  480. tocContainer.setAttribute('class', 'isShowingTOC');
  481. window.name = "";
  482. }
  483. return false;
  484. }
  485. function toggleTOCEntryChildren(e)
  486. {
  487. e.stopPropagation();
  488. var currentClass = this.getAttribute('class');
  489. if (currentClass == 'children') {
  490. this.setAttribute('class', 'children open');
  491. }
  492. else if (currentClass == 'children open') {
  493. this.setAttribute('class', 'children');
  494. }
  495. return false;
  496. }
  497. function tocEntryClick(e)
  498. {
  499. e.stopPropagation();
  500. return true;
  501. }
  502. function init()
  503. {
  504. var selectElement = document.getElementById('jumpTo');
  505. selectElement.addEventListener('change', jumpToChange, false);
  506. var tocButton = document.getElementById('table_of_contents');
  507. tocButton.addEventListener('click', toggleTOC, false);
  508. var taskTreeItem = document.getElementById('task_treeitem');
  509. if (taskTreeItem.getElementsByTagName('li').length > 0)
  510. {
  511. taskTreeItem.setAttribute('class', 'children');
  512. taskTreeItem.firstChild.setAttribute('class', 'disclosure');
  513. }
  514. var tocList = document.getElementById('toc');
  515. var tocEntries = tocList.getElementsByTagName('li');
  516. for (var i = 0; i < tocEntries.length; i++) {
  517. tocEntries[i].addEventListener('click', toggleTOCEntryChildren, false);
  518. }
  519. var tocLinks = tocList.getElementsByTagName('a');
  520. for (var i = 0; i < tocLinks.length; i++) {
  521. tocLinks[i].addEventListener('click', tocEntryClick, false);
  522. }
  523. if (window.name == "hideTOC") {
  524. toggleTOC.call(tocButton);
  525. }
  526. }
  527. window.onload = init;
  528. // If showing in Xcode, hide the TOC and Header
  529. if (navigator.userAgent.match(/xcode/i)) {
  530. document.getElementById("contents").className = "hideInXcode"
  531. document.getElementById("tocContainer").className = "hideInXcode"
  532. document.getElementById("top_header").className = "hideInXcode"
  533. }
  534. </script>
  535. </body>
  536. </html>