PageRenderTime 65ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 1ms

/Pods/Documentation/CocoaAsyncSocket/docset/Contents/Resources/Documents/Classes/AsyncSocket.html

https://gitlab.com/mba811/tokaidoapp
HTML | 2723 lines | 1419 code | 1304 blank | 0 comment | 0 complexity | 521388357f202c0aa2f3639ba34346b2 MD5 | raw file
Possible License(s): BSD-3-Clause

Large files files are truncated, but you can click here to view the full file

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="html/html; charset=utf-8" />
  5. <title>AsyncSocket Class 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">AsyncSocket Class 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="class_methods">Class Methods</option>
  29. <option value="//api/name/CRData">&nbsp;&nbsp;&nbsp;&nbsp;+ CRData</option>
  30. <option value="//api/name/CRLFData">&nbsp;&nbsp;&nbsp;&nbsp;+ CRLFData</option>
  31. <option value="//api/name/LFData">&nbsp;&nbsp;&nbsp;&nbsp;+ LFData</option>
  32. <option value="//api/name/ZeroData">&nbsp;&nbsp;&nbsp;&nbsp;+ ZeroData</option>
  33. <option value="instance_methods">Instance Methods</option>
  34. <option value="//api/name/acceptOnInterface:port:error:">&nbsp;&nbsp;&nbsp;&nbsp;- acceptOnInterface:port:error:</option>
  35. <option value="//api/name/acceptOnPort:error:">&nbsp;&nbsp;&nbsp;&nbsp;- acceptOnPort:error:</option>
  36. <option value="//api/name/addRunLoopMode:">&nbsp;&nbsp;&nbsp;&nbsp;- addRunLoopMode:</option>
  37. <option value="//api/name/canSafelySetDelegate">&nbsp;&nbsp;&nbsp;&nbsp;- canSafelySetDelegate</option>
  38. <option value="//api/name/connectToAddress:error:">&nbsp;&nbsp;&nbsp;&nbsp;- connectToAddress:error:</option>
  39. <option value="//api/name/connectToAddress:viaInterfaceAddress:withTimeout:error:">&nbsp;&nbsp;&nbsp;&nbsp;- connectToAddress:viaInterfaceAddress:withTimeout:error:</option>
  40. <option value="//api/name/connectToAddress:withTimeout:error:">&nbsp;&nbsp;&nbsp;&nbsp;- connectToAddress:withTimeout:error:</option>
  41. <option value="//api/name/connectToHost:onPort:error:">&nbsp;&nbsp;&nbsp;&nbsp;- connectToHost:onPort:error:</option>
  42. <option value="//api/name/connectToHost:onPort:withTimeout:error:">&nbsp;&nbsp;&nbsp;&nbsp;- connectToHost:onPort:withTimeout:error:</option>
  43. <option value="//api/name/connectedAddress">&nbsp;&nbsp;&nbsp;&nbsp;- connectedAddress</option>
  44. <option value="//api/name/connectedHost">&nbsp;&nbsp;&nbsp;&nbsp;- connectedHost</option>
  45. <option value="//api/name/connectedPort">&nbsp;&nbsp;&nbsp;&nbsp;- connectedPort</option>
  46. <option value="//api/name/delegate">&nbsp;&nbsp;&nbsp;&nbsp;- delegate</option>
  47. <option value="//api/name/description">&nbsp;&nbsp;&nbsp;&nbsp;- description</option>
  48. <option value="//api/name/disconnect">&nbsp;&nbsp;&nbsp;&nbsp;- disconnect</option>
  49. <option value="//api/name/disconnectAfterReading">&nbsp;&nbsp;&nbsp;&nbsp;- disconnectAfterReading</option>
  50. <option value="//api/name/disconnectAfterReadingAndWriting">&nbsp;&nbsp;&nbsp;&nbsp;- disconnectAfterReadingAndWriting</option>
  51. <option value="//api/name/disconnectAfterWriting">&nbsp;&nbsp;&nbsp;&nbsp;- disconnectAfterWriting</option>
  52. <option value="//api/name/enablePreBuffering">&nbsp;&nbsp;&nbsp;&nbsp;- enablePreBuffering</option>
  53. <option value="//api/name/getCFReadStream">&nbsp;&nbsp;&nbsp;&nbsp;- getCFReadStream</option>
  54. <option value="//api/name/getCFSocket">&nbsp;&nbsp;&nbsp;&nbsp;- getCFSocket</option>
  55. <option value="//api/name/getCFWriteStream">&nbsp;&nbsp;&nbsp;&nbsp;- getCFWriteStream</option>
  56. <option value="//api/name/init">&nbsp;&nbsp;&nbsp;&nbsp;- init</option>
  57. <option value="//api/name/initWithDelegate:">&nbsp;&nbsp;&nbsp;&nbsp;- initWithDelegate:</option>
  58. <option value="//api/name/initWithDelegate:userData:">&nbsp;&nbsp;&nbsp;&nbsp;- initWithDelegate:userData:</option>
  59. <option value="//api/name/isConnected">&nbsp;&nbsp;&nbsp;&nbsp;- isConnected</option>
  60. <option value="//api/name/isIPv4">&nbsp;&nbsp;&nbsp;&nbsp;- isIPv4</option>
  61. <option value="//api/name/isIPv6">&nbsp;&nbsp;&nbsp;&nbsp;- isIPv6</option>
  62. <option value="//api/name/localAddress">&nbsp;&nbsp;&nbsp;&nbsp;- localAddress</option>
  63. <option value="//api/name/localHost">&nbsp;&nbsp;&nbsp;&nbsp;- localHost</option>
  64. <option value="//api/name/localPort">&nbsp;&nbsp;&nbsp;&nbsp;- localPort</option>
  65. <option value="//api/name/moveToRunLoop:">&nbsp;&nbsp;&nbsp;&nbsp;- moveToRunLoop:</option>
  66. <option value="//api/name/progressOfReadReturningTag:bytesDone:total:">&nbsp;&nbsp;&nbsp;&nbsp;- progressOfReadReturningTag:bytesDone:total:</option>
  67. <option value="//api/name/progressOfWriteReturningTag:bytesDone:total:">&nbsp;&nbsp;&nbsp;&nbsp;- progressOfWriteReturningTag:bytesDone:total:</option>
  68. <option value="//api/name/readDataToData:withTimeout:buffer:bufferOffset:maxLength:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- readDataToData:withTimeout:buffer:bufferOffset:maxLength:tag:</option>
  69. <option value="//api/name/readDataToData:withTimeout:buffer:bufferOffset:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- readDataToData:withTimeout:buffer:bufferOffset:tag:</option>
  70. <option value="//api/name/readDataToData:withTimeout:maxLength:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- readDataToData:withTimeout:maxLength:tag:</option>
  71. <option value="//api/name/readDataToData:withTimeout:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- readDataToData:withTimeout:tag:</option>
  72. <option value="//api/name/readDataToLength:withTimeout:buffer:bufferOffset:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- readDataToLength:withTimeout:buffer:bufferOffset:tag:</option>
  73. <option value="//api/name/readDataToLength:withTimeout:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- readDataToLength:withTimeout:tag:</option>
  74. <option value="//api/name/readDataWithTimeout:buffer:bufferOffset:maxLength:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- readDataWithTimeout:buffer:bufferOffset:maxLength:tag:</option>
  75. <option value="//api/name/readDataWithTimeout:buffer:bufferOffset:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- readDataWithTimeout:buffer:bufferOffset:tag:</option>
  76. <option value="//api/name/readDataWithTimeout:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- readDataWithTimeout:tag:</option>
  77. <option value="//api/name/removeRunLoopMode:">&nbsp;&nbsp;&nbsp;&nbsp;- removeRunLoopMode:</option>
  78. <option value="//api/name/runLoopModes">&nbsp;&nbsp;&nbsp;&nbsp;- runLoopModes</option>
  79. <option value="//api/name/setDelegate:">&nbsp;&nbsp;&nbsp;&nbsp;- setDelegate:</option>
  80. <option value="//api/name/setRunLoopModes:">&nbsp;&nbsp;&nbsp;&nbsp;- setRunLoopModes:</option>
  81. <option value="//api/name/setUserData:">&nbsp;&nbsp;&nbsp;&nbsp;- setUserData:</option>
  82. <option value="//api/name/startTLS:">&nbsp;&nbsp;&nbsp;&nbsp;- startTLS:</option>
  83. <option value="//api/name/unreadData">&nbsp;&nbsp;&nbsp;&nbsp;- unreadData</option>
  84. <option value="//api/name/userData">&nbsp;&nbsp;&nbsp;&nbsp;- userData</option>
  85. <option value="//api/name/writeData:withTimeout:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- writeData:withTimeout:tag:</option>
  86. </select>
  87. </li>
  88. </ul>
  89. </header>
  90. <nav id="tocContainer" class="isShowingTOC">
  91. <ul id="toc" role="tree">
  92. <li role="treeitem" id="task_treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#tasks">Tasks</a></span><ul>
  93. </ul></li>
  94. <li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#class_methods">Class Methods</a></span><ul>
  95. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/CRData">CRData</a></span></li>
  96. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/CRLFData">CRLFData</a></span></li>
  97. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/LFData">LFData</a></span></li>
  98. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/ZeroData">ZeroData</a></span></li>
  99. </ul></li>
  100. <li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#instance_methods">Instance Methods</a></span><ul>
  101. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/acceptOnInterface:port:error:">acceptOnInterface:port:error:</a></span></li>
  102. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/acceptOnPort:error:">acceptOnPort:error:</a></span></li>
  103. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/addRunLoopMode:">addRunLoopMode:</a></span></li>
  104. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/canSafelySetDelegate">canSafelySetDelegate</a></span></li>
  105. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectToAddress:error:">connectToAddress:error:</a></span></li>
  106. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectToAddress:viaInterfaceAddress:withTimeout:error:">connectToAddress:viaInterfaceAddress:withTimeout:error:</a></span></li>
  107. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectToAddress:withTimeout:error:">connectToAddress:withTimeout:error:</a></span></li>
  108. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectToHost:onPort:error:">connectToHost:onPort:error:</a></span></li>
  109. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectToHost:onPort:withTimeout:error:">connectToHost:onPort:withTimeout:error:</a></span></li>
  110. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectedAddress">connectedAddress</a></span></li>
  111. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectedHost">connectedHost</a></span></li>
  112. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectedPort">connectedPort</a></span></li>
  113. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/delegate">delegate</a></span></li>
  114. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/description">description</a></span></li>
  115. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/disconnect">disconnect</a></span></li>
  116. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/disconnectAfterReading">disconnectAfterReading</a></span></li>
  117. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/disconnectAfterReadingAndWriting">disconnectAfterReadingAndWriting</a></span></li>
  118. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/disconnectAfterWriting">disconnectAfterWriting</a></span></li>
  119. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/enablePreBuffering">enablePreBuffering</a></span></li>
  120. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/getCFReadStream">getCFReadStream</a></span></li>
  121. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/getCFSocket">getCFSocket</a></span></li>
  122. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/getCFWriteStream">getCFWriteStream</a></span></li>
  123. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/init">init</a></span></li>
  124. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/initWithDelegate:">initWithDelegate:</a></span></li>
  125. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/initWithDelegate:userData:">initWithDelegate:userData:</a></span></li>
  126. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isConnected">isConnected</a></span></li>
  127. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isIPv4">isIPv4</a></span></li>
  128. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isIPv6">isIPv6</a></span></li>
  129. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/localAddress">localAddress</a></span></li>
  130. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/localHost">localHost</a></span></li>
  131. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/localPort">localPort</a></span></li>
  132. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/moveToRunLoop:">moveToRunLoop:</a></span></li>
  133. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/progressOfReadReturningTag:bytesDone:total:">progressOfReadReturningTag:bytesDone:total:</a></span></li>
  134. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/progressOfWriteReturningTag:bytesDone:total:">progressOfWriteReturningTag:bytesDone:total:</a></span></li>
  135. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/readDataToData:withTimeout:buffer:bufferOffset:maxLength:tag:">readDataToData:withTimeout:buffer:bufferOffset:maxLength:tag:</a></span></li>
  136. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/readDataToData:withTimeout:buffer:bufferOffset:tag:">readDataToData:withTimeout:buffer:bufferOffset:tag:</a></span></li>
  137. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/readDataToData:withTimeout:maxLength:tag:">readDataToData:withTimeout:maxLength:tag:</a></span></li>
  138. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/readDataToData:withTimeout:tag:">readDataToData:withTimeout:tag:</a></span></li>
  139. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/readDataToLength:withTimeout:buffer:bufferOffset:tag:">readDataToLength:withTimeout:buffer:bufferOffset:tag:</a></span></li>
  140. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/readDataToLength:withTimeout:tag:">readDataToLength:withTimeout:tag:</a></span></li>
  141. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/readDataWithTimeout:buffer:bufferOffset:maxLength:tag:">readDataWithTimeout:buffer:bufferOffset:maxLength:tag:</a></span></li>
  142. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/readDataWithTimeout:buffer:bufferOffset:tag:">readDataWithTimeout:buffer:bufferOffset:tag:</a></span></li>
  143. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/readDataWithTimeout:tag:">readDataWithTimeout:tag:</a></span></li>
  144. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/removeRunLoopMode:">removeRunLoopMode:</a></span></li>
  145. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/runLoopModes">runLoopModes</a></span></li>
  146. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setDelegate:">setDelegate:</a></span></li>
  147. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setRunLoopModes:">setRunLoopModes:</a></span></li>
  148. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setUserData:">setUserData:</a></span></li>
  149. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/startTLS:">startTLS:</a></span></li>
  150. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/unreadData">unreadData</a></span></li>
  151. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/userData">userData</a></span></li>
  152. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/writeData:withTimeout:tag:">writeData:withTimeout:tag:</a></span></li>
  153. </ul></li>
  154. </ul>
  155. </nav>
  156. <article>
  157. <div id="contents" class="isShowingTOC" role="main">
  158. <a title="AsyncSocket Class Reference" name="top"></a>
  159. <div class="main-navigation navigation-top">
  160. <ul>
  161. <li><a href="../index.html">Index</a></li>
  162. <li><a href="../hierarchy.html">Hierarchy</a></li>
  163. </ul>
  164. </div>
  165. <div id="header">
  166. <div class="section-header">
  167. <h1 class="title title-header">AsyncSocket Class Reference</h1>
  168. </div>
  169. </div>
  170. <div id="container">
  171. <div class="section section-specification"><table cellspacing="0"><tbody>
  172. <tr>
  173. <td class="specification-title">Inherits from</td>
  174. <td class="specification-value">NSObject</td>
  175. </tr><tr>
  176. <td class="specification-title">Declared in</td>
  177. <td class="specification-value">AsyncSocket.h</td>
  178. </tr>
  179. </tbody></table></div>
  180. <div class="section section-tasks">
  181. <a title="Tasks" name="tasks"></a>
  182. <h2 class="subtitle subtitle-tasks">Tasks</h2>
  183. <ul class="task-list">
  184. <li>
  185. <span class="tooltip">
  186. <code><a href="#//api/name/init">&ndash;&nbsp;init</a></code>
  187. </span>
  188. </li><li>
  189. <span class="tooltip">
  190. <code><a href="#//api/name/initWithDelegate:">&ndash;&nbsp;initWithDelegate:</a></code>
  191. </span>
  192. </li><li>
  193. <span class="tooltip">
  194. <code><a href="#//api/name/initWithDelegate:userData:">&ndash;&nbsp;initWithDelegate:userData:</a></code>
  195. </span>
  196. </li><li>
  197. <span class="tooltip">
  198. <code><a href="#//api/name/description">&ndash;&nbsp;description</a></code>
  199. </span>
  200. </li><li>
  201. <span class="tooltip">
  202. <code><a href="#//api/name/delegate">&ndash;&nbsp;delegate</a></code>
  203. <span class="tooltip"><p>Use &ldquo;canSafelySetDelegate&rdquo; to see if there is any pending business (reads and writes) with the current delegate<br/>
  204. before changing it. It is, of course, safe to change the delegate before connecting or accepting connections.</p></span>
  205. </span>
  206. </li><li>
  207. <span class="tooltip">
  208. <code><a href="#//api/name/canSafelySetDelegate">&ndash;&nbsp;canSafelySetDelegate</a></code>
  209. </span>
  210. </li><li>
  211. <span class="tooltip">
  212. <code><a href="#//api/name/setDelegate:">&ndash;&nbsp;setDelegate:</a></code>
  213. </span>
  214. </li><li>
  215. <span class="tooltip">
  216. <code><a href="#//api/name/userData">&ndash;&nbsp;userData</a></code>
  217. </span>
  218. </li><li>
  219. <span class="tooltip">
  220. <code><a href="#//api/name/setUserData:">&ndash;&nbsp;setUserData:</a></code>
  221. </span>
  222. </li><li>
  223. <span class="tooltip">
  224. <code><a href="#//api/name/getCFSocket">&ndash;&nbsp;getCFSocket</a></code>
  225. </span>
  226. </li><li>
  227. <span class="tooltip">
  228. <code><a href="#//api/name/getCFReadStream">&ndash;&nbsp;getCFReadStream</a></code>
  229. </span>
  230. </li><li>
  231. <span class="tooltip">
  232. <code><a href="#//api/name/getCFWriteStream">&ndash;&nbsp;getCFWriteStream</a></code>
  233. </span>
  234. </li><li>
  235. <span class="tooltip">
  236. <code><a href="#//api/name/acceptOnPort:error:">&ndash;&nbsp;acceptOnPort:error:</a></code>
  237. <span class="tooltip"><p>Tells the socket to begin listening and accepting connections on the given port.<br/>
  238. When a connection comes in, the AsyncSocket instance will call the various <a href="#//api/name/delegate">delegate</a> methods (see above).<br/>
  239. The socket will listen on all available interfaces (e.g. wifi, ethernet, etc)</p></span>
  240. </span>
  241. </li><li>
  242. <span class="tooltip">
  243. <code><a href="#//api/name/acceptOnInterface:port:error:">&ndash;&nbsp;acceptOnInterface:port:error:</a></code>
  244. <span class="tooltip"><p>This method is the same as <a href="#//api/name/acceptOnPort:error:">acceptOnPort:error:</a> with the additional option<br/>
  245. of specifying which interface to listen on. So, for example, if you were writing code for a server that<br/>
  246. has multiple IP addresses, you could specify which address you wanted to listen on. Or you could use it<br/>
  247. to specify that the socket should only accept connections over ethernet, and not other interfaces such as wifi.<br/>
  248. You may also use the special strings &ldquo;localhost&rdquo; or &ldquo;loopback&rdquo; to specify that<br/>
  249. the socket only accept connections from the local machine.</p></span>
  250. </span>
  251. </li><li>
  252. <span class="tooltip">
  253. <code><a href="#//api/name/connectToHost:onPort:error:">&ndash;&nbsp;connectToHost:onPort:error:</a></code>
  254. <span class="tooltip"><p>Connects to the given host and port.<br/>
  255. The host may be a domain name (e.g. &ldquo;deusty.com&rdquo;) or an IP address string (e.g. &ldquo;192.168.0.2&rdquo;)</p></span>
  256. </span>
  257. </li><li>
  258. <span class="tooltip">
  259. <code><a href="#//api/name/connectToHost:onPort:withTimeout:error:">&ndash;&nbsp;connectToHost:onPort:withTimeout:error:</a></code>
  260. <span class="tooltip"><p>This method is the same as <a href="#//api/name/connectToHost:onPort:error:">connectToHost:onPort:error:</a> with an additional timeout option.<br/>
  261. To not time out use a negative time interval, or simply use the <a href="#//api/name/connectToHost:onPort:error:">connectToHost:onPort:error:</a> method.</p></span>
  262. </span>
  263. </li><li>
  264. <span class="tooltip">
  265. <code><a href="#//api/name/connectToAddress:error:">&ndash;&nbsp;connectToAddress:error:</a></code>
  266. <span class="tooltip"><p>Connects to the given address, specified as a sockaddr structure wrapped in a NSData object.<br/>
  267. For example, a NSData object returned from NSNetService&rsquo;s addresses method.</p></span>
  268. </span>
  269. </li><li>
  270. <span class="tooltip">
  271. <code><a href="#//api/name/connectToAddress:withTimeout:error:">&ndash;&nbsp;connectToAddress:withTimeout:error:</a></code>
  272. <span class="tooltip"><p>This method is the same as <a href="#//api/name/connectToAddress:error:">connectToAddress:error:</a> with an additional timeout option.<br/>
  273. To not time out use a negative time interval, or simply use the <a href="#//api/name/connectToAddress:error:">connectToAddress:error:</a> method.</p></span>
  274. </span>
  275. </li><li>
  276. <span class="tooltip">
  277. <code><a href="#//api/name/connectToAddress:viaInterfaceAddress:withTimeout:error:">&ndash;&nbsp;connectToAddress:viaInterfaceAddress:withTimeout:error:</a></code>
  278. </span>
  279. </li><li>
  280. <span class="tooltip">
  281. <code><a href="#//api/name/disconnect">&ndash;&nbsp;disconnect</a></code>
  282. <span class="tooltip"><p>Disconnects immediately. Any pending reads or writes are dropped.<br/>
  283. If the socket is not already disconnected, the onSocketDidDisconnect <a href="#//api/name/delegate">delegate</a> method<br/>
  284. will be called immediately, before this method returns.</p></span>
  285. </span>
  286. </li><li>
  287. <span class="tooltip">
  288. <code><a href="#//api/name/disconnectAfterReading">&ndash;&nbsp;disconnectAfterReading</a></code>
  289. <span class="tooltip"><p>Disconnects after all pending reads have completed.<br/>
  290. After calling this, the read and write methods will do nothing.<br/>
  291. The socket will <a href="#//api/name/disconnect">disconnect</a> even if there are still pending writes.</p></span>
  292. </span>
  293. </li><li>
  294. <span class="tooltip">
  295. <code><a href="#//api/name/disconnectAfterWriting">&ndash;&nbsp;disconnectAfterWriting</a></code>
  296. <span class="tooltip"><p>Disconnects after all pending writes have completed.<br/>
  297. After calling this, the read and write methods will do nothing.<br/>
  298. The socket will <a href="#//api/name/disconnect">disconnect</a> even if there are still pending reads.</p></span>
  299. </span>
  300. </li><li>
  301. <span class="tooltip">
  302. <code><a href="#//api/name/disconnectAfterReadingAndWriting">&ndash;&nbsp;disconnectAfterReadingAndWriting</a></code>
  303. <span class="tooltip"><p>Disconnects after all pending reads and writes have completed.<br/>
  304. After calling this, the read and write methods will do nothing.</p></span>
  305. </span>
  306. </li><li>
  307. <span class="tooltip">
  308. <code><a href="#//api/name/isConnected">&ndash;&nbsp;isConnected</a></code>
  309. </span>
  310. </li><li>
  311. <span class="tooltip">
  312. <code><a href="#//api/name/connectedHost">&ndash;&nbsp;connectedHost</a></code>
  313. <span class="tooltip"><p>Returns the local or remote host and port to which this socket is connected, or nil and 0 if not connected.<br/>
  314. The host will be an IP address.</p></span>
  315. </span>
  316. </li><li>
  317. <span class="tooltip">
  318. <code><a href="#//api/name/connectedPort">&ndash;&nbsp;connectedPort</a></code>
  319. </span>
  320. </li><li>
  321. <span class="tooltip">
  322. <code><a href="#//api/name/localHost">&ndash;&nbsp;localHost</a></code>
  323. </span>
  324. </li><li>
  325. <span class="tooltip">
  326. <code><a href="#//api/name/localPort">&ndash;&nbsp;localPort</a></code>
  327. </span>
  328. </li><li>
  329. <span class="tooltip">
  330. <code><a href="#//api/name/connectedAddress">&ndash;&nbsp;connectedAddress</a></code>
  331. <span class="tooltip"><p>Returns the local or remote address to which this socket is connected,<br/>
  332. specified as a sockaddr structure wrapped in a NSData object.</p></span>
  333. </span>
  334. </li><li>
  335. <span class="tooltip">
  336. <code><a href="#//api/name/localAddress">&ndash;&nbsp;localAddress</a></code>
  337. </span>
  338. </li><li>
  339. <span class="tooltip">
  340. <code><a href="#//api/name/isIPv4">&ndash;&nbsp;isIPv4</a></code>
  341. <span class="tooltip"><p>Returns whether the socket is IPv4 or IPv6.<br/>
  342. An accepting socket may be both.</p></span>
  343. </span>
  344. </li><li>
  345. <span class="tooltip">
  346. <code><a href="#//api/name/isIPv6">&ndash;&nbsp;isIPv6</a></code>
  347. </span>
  348. </li><li>
  349. <span class="tooltip">
  350. <code><a href="#//api/name/readDataWithTimeout:tag:">&ndash;&nbsp;readDataWithTimeout:tag:</a></code>
  351. <span class="tooltip"><p>Reads the first available bytes that become available on the socket.</p></span>
  352. </span>
  353. </li><li>
  354. <span class="tooltip">
  355. <code><a href="#//api/name/readDataWithTimeout:buffer:bufferOffset:tag:">&ndash;&nbsp;readDataWithTimeout:buffer:bufferOffset:tag:</a></code>
  356. <span class="tooltip"><p>Reads the first available bytes that become available on the socket.<br/>
  357. The bytes will be appended to the given byte buffer starting at the given offset.<br/>
  358. The given buffer will automatically be increased in size if needed.</p></span>
  359. </span>
  360. </li><li>
  361. <span class="tooltip">
  362. <code><a href="#//api/name/readDataWithTimeout:buffer:bufferOffset:maxLength:tag:">&ndash;&nbsp;readDataWithTimeout:buffer:bufferOffset:maxLength:tag:</a></code>
  363. <span class="tooltip"><p>Reads the first available bytes that become available on the socket.<br/>
  364. The bytes will be appended to the given byte buffer starting at the given offset.<br/>
  365. The given buffer will automatically be increased in size if needed.<br/>
  366. A maximum of length bytes will be read.</p></span>
  367. </span>
  368. </li><li>
  369. <span class="tooltip">
  370. <code><a href="#//api/name/readDataToLength:withTimeout:tag:">&ndash;&nbsp;readDataToLength:withTimeout:tag:</a></code>
  371. <span class="tooltip"><p>Reads the given number of bytes.</p></span>
  372. </span>
  373. </li><li>
  374. <span class="tooltip">
  375. <code><a href="#//api/name/readDataToLength:withTimeout:buffer:bufferOffset:tag:">&ndash;&nbsp;readDataToLength:withTimeout:buffer:bufferOffset:tag:</a></code>
  376. <span class="tooltip"><p>Reads the given number of bytes.<br/>
  377. The bytes will be appended to the given byte buffer starting at the given offset.<br/>
  378. The given buffer will automatically be increased in size if needed.</p></span>
  379. </span>
  380. </li><li>
  381. <span class="tooltip">
  382. <code><a href="#//api/name/readDataToData:withTimeout:tag:">&ndash;&nbsp;readDataToData:withTimeout:tag:</a></code>
  383. <span class="tooltip"><p>Reads bytes until (and including) the passed &ldquo;data&rdquo; parameter, which acts as a separator.</p></span>
  384. </span>
  385. </li><li>
  386. <span class="tooltip">
  387. <code><a href="#//api/name/readDataToData:withTimeout:buffer:bufferOffset:tag:">&ndash;&nbsp;readDataToData:withTimeout:buffer:bufferOffset:tag:</a></code>
  388. <span class="tooltip"><p>Reads bytes until (and including) the passed &ldquo;data&rdquo; parameter, which acts as a separator.<br/>
  389. The bytes will be appended to the given byte buffer starting at the given offset.<br/>
  390. The given buffer will automatically be increased in size if needed.</p></span>
  391. </span>
  392. </li><li>
  393. <span class="tooltip">
  394. <code><a href="#//api/name/readDataToData:withTimeout:maxLength:tag:">&ndash;&nbsp;readDataToData:withTimeout:maxLength:tag:</a></code>
  395. <span class="tooltip"><p>Reads bytes until (and including) the passed &ldquo;data&rdquo; parameter, which acts as a separator.</p></span>
  396. </span>
  397. </li><li>
  398. <span class="tooltip">
  399. <code><a href="#//api/name/readDataToData:withTimeout:buffer:bufferOffset:maxLength:tag:">&ndash;&nbsp;readDataToData:withTimeout:buffer:bufferOffset:maxLength:tag:</a></code>
  400. <span class="tooltip"><p>Reads bytes until (and including) the passed &ldquo;data&rdquo; parameter, which acts as a separator.<br/>
  401. The bytes will be appended to the given byte buffer starting at the given offset.<br/>
  402. The given buffer will automatically be increased in size if needed.<br/>
  403. A maximum of length bytes will be read.</p></span>
  404. </span>
  405. </li><li>
  406. <span class="tooltip">
  407. <code><a href="#//api/name/writeData:withTimeout:tag:">&ndash;&nbsp;writeData:withTimeout:tag:</a></code>
  408. <span class="tooltip"><p>Writes data to the socket, and calls the <a href="#//api/name/delegate">delegate</a> when finished.</p></span>
  409. </span>
  410. </li><li>
  411. <span class="tooltip">
  412. <code><a href="#//api/name/progressOfReadReturningTag:bytesDone:total:">&ndash;&nbsp;progressOfReadReturningTag:bytesDone:total:</a></code>
  413. <span class="tooltip"><p>Returns progress of current read or write, from 0.0 to 1.0, or NaN if no read/write (use isnan() to check).<br/>
  414. &ldquo;tag&rdquo;, &ldquo;done&rdquo; and &ldquo;total&rdquo; will be filled in if they aren&rsquo;t NULL.</p></span>
  415. </span>
  416. </li><li>
  417. <span class="tooltip">
  418. <code><a href="#//api/name/progressOfWriteReturningTag:bytesDone:total:">&ndash;&nbsp;progressOfWriteReturningTag:bytesDone:total:</a></code>
  419. </span>
  420. </li><li>
  421. <span class="tooltip">
  422. <code><a href="#//api/name/startTLS:">&ndash;&nbsp;startTLS:</a></code>
  423. <span class="tooltip"><p>Secures the connection using SSL/TLS.</p></span>
  424. </span>
  425. </li><li>
  426. <span class="tooltip">
  427. <code><a href="#//api/name/enablePreBuffering">&ndash;&nbsp;enablePreBuffering</a></code>
  428. <span class="tooltip"><p>For handling readDataToData requests, data is necessarily read from the socket in small increments.<br/>
  429. The performance can be much improved by allowing AsyncSocket to read larger chunks at a time and<br/>
  430. store any overflow in a small internal buffer.<br/>
  431. This is termed pre-buffering, as some data may be read for you before you ask for it.<br/>
  432. If you use readDataToData a lot, enabling pre-buffering will result in better performance, especially on the iPhone.</p></span>
  433. </span>
  434. </li><li>
  435. <span class="tooltip">
  436. <code><a href="#//api/name/moveToRunLoop:">&ndash;&nbsp;moveToRunLoop:</a></code>
  437. <span class="tooltip"><p>When you create an AsyncSocket, it is added to the runloop of the current thread.<br/>
  438. So for manually created sockets, it is easiest to simply create the socket on the thread you intend to use it.</p></span>
  439. </span>
  440. </li><li>
  441. <span class="tooltip">
  442. <code><a href="#//api/name/setRunLoopModes:">&ndash;&nbsp;setRunLoopModes:</a></code>
  443. <span class="tooltip"><p>Allows you to configure which run loop modes the socket uses.<br/>
  444. The default set of run loop modes is NSDefaultRunLoopMode.</p></span>
  445. </span>
  446. </li><li>
  447. <span class="tooltip">
  448. <code><a href="#//api/name/addRunLoopMode:">&ndash;&nbsp;addRunLoopMode:</a></code>
  449. </span>
  450. </li><li>
  451. <span class="tooltip">
  452. <code><a href="#//api/name/removeRunLoopMode:">&ndash;&nbsp;removeRunLoopMode:</a></code>
  453. </span>
  454. </li><li>
  455. <span class="tooltip">
  456. <code><a href="#//api/name/runLoopModes">&ndash;&nbsp;runLoopModes</a></code>
  457. <span class="tooltip"><p>Returns the current run loop modes the AsyncSocket instance is operating in.<br/>
  458. The default set of run loop modes is NSDefaultRunLoopMode.</p></span>
  459. </span>
  460. </li><li>
  461. <span class="tooltip">
  462. <code><a href="#//api/name/unreadData">&ndash;&nbsp;unreadData</a></code>
  463. <span class="tooltip"><p>In the event of an error, this method may be called during onSocket:willDisconnectWithError: to read<br/>
  464. any data that&rsquo;s left on the socket.</p></span>
  465. </span>
  466. </li><li>
  467. <span class="tooltip">
  468. <code><a href="#//api/name/CRLFData">+&nbsp;CRLFData</a></code>
  469. </span>
  470. </li><li>
  471. <span class="tooltip">
  472. <code><a href="#//api/name/CRData">+&nbsp;CRData</a></code>
  473. </span>
  474. </li><li>
  475. <span class="tooltip">
  476. <code><a href="#//api/name/LFData">+&nbsp;LFData</a></code>
  477. </span>
  478. </li><li>
  479. <span class="tooltip">
  480. <code><a href="#//api/name/ZeroData">+&nbsp;ZeroData</a></code>
  481. </span>
  482. </li>
  483. </ul>
  484. </div>
  485. <div class="section section-methods">
  486. <a title="Class Methods" name="class_methods"></a>
  487. <h2 class="subtitle subtitle-methods">Class Methods</h2>
  488. <div class="section-method">
  489. <a name="//api/name/CRData" title="CRData"></a>
  490. <h3 class="subsubtitle method-title">CRData</h3>
  491. <div class="method-subsection method-declaration"><code>+ (NSData *)CRData</code></div>
  492. </div>
  493. <div class="section-method">
  494. <a name="//api/name/CRLFData" title="CRLFData"></a>
  495. <h3 class="subsubtitle method-title">CRLFData</h3>
  496. <div class="method-subsection method-declaration"><code>+ (NSData *)CRLFData</code></div>
  497. </div>
  498. <div class="section-method">
  499. <a name="//api/name/LFData" title="LFData"></a>
  500. <h3 class="subsubtitle method-title">LFData</h3>
  501. <div class="method-subsection method-declaration"><code>+ (NSData *)LFData</code></div>
  502. </div>
  503. <div class="section-method">
  504. <a name="//api/name/ZeroData" title="ZeroData"></a>
  505. <h3 class="subsubtitle method-title">ZeroData</h3>
  506. <div class="method-subsection method-declaration"><code>+ (NSData *)ZeroData</code></div>
  507. </div>
  508. </div>
  509. <div class="section section-methods">
  510. <a title="Instance Methods" name="instance_methods"></a>
  511. <h2 class="subtitle subtitle-methods">Instance Methods</h2>
  512. <div class="section-method">
  513. <a name="//api/name/acceptOnInterface:port:error:" title="acceptOnInterface:port:error:"></a>
  514. <h3 class="subsubtitle method-title">acceptOnInterface:port:error:</h3>
  515. <div class="method-subsection brief-description">
  516. <p>This method is the same as <a href="#//api/name/acceptOnPort:error:">acceptOnPort:error:</a> with the additional option<br/>
  517. of specifying which interface to listen on. So, for example, if you were writing code for a server that<br/>
  518. has multiple IP addresses, you could specify which address you wanted to listen on. Or you could use it<br/>
  519. to specify that the socket should only accept connections over ethernet, and not other interfaces such as wifi.<br/>
  520. You may also use the special strings &ldquo;localhost&rdquo; or &ldquo;loopback&rdquo; to specify that<br/>
  521. the socket only accept connections from the local machine.</p>
  522. </div>
  523. <div class="method-subsection method-declaration"><code>- (BOOL)acceptOnInterface:(NSString *)<em>interface</em> port:(UInt16)<em>port</em> error:(NSError **)<em>errPtr</em></code></div>
  524. <div class="method-subsection discussion-section">
  525. <h4 class="method-subtitle">Discussion</h4>
  526. <p>This method is the same as <a href="#//api/name/acceptOnPort:error:">acceptOnPort:error:</a> with the additional option<br/>
  527. of specifying which interface to listen on. So, for example, if you were writing code for a server that<br/>
  528. has multiple IP addresses, you could specify which address you wanted to listen on. Or you could use it<br/>
  529. to specify that the socket should only accept connections over ethernet, and not other interfaces such as wifi.<br/>
  530. You may also use the special strings &ldquo;localhost&rdquo; or &ldquo;loopback&rdquo; to specify that<br/>
  531. the socket only accept connections from the local machine.</p>
  532. <p>To accept connections on any interface pass nil, or simply use the <a href="#//api/name/acceptOnPort:error:">acceptOnPort:error:</a> method.</p>
  533. </div>
  534. <div class="method-subsection declared-in-section">
  535. <h4 class="method-subtitle">Declared In</h4>
  536. <code class="declared-in-ref">AsyncSocket.h</code><br />
  537. </div>
  538. </div>
  539. <div class="section-method">
  540. <a name="//api/name/acceptOnPort:error:" title="acceptOnPort:error:"></a>
  541. <h3 class="subsubtitle method-title">acceptOnPort:error:</h3>
  542. <div class="method-subsection brief-description">
  543. <p>Tells the socket to begin listening and accepting connections on the given port.<br/>
  544. When a connection comes in, the AsyncSocket instance will call the various <a href="#//api/name/delegate">delegate</a> methods (see above).<br/>
  545. The socket will listen on all available interfaces (e.g. wifi, ethernet, etc)</p>
  546. </div>
  547. <div class="method-subsection method-declaration"><code>- (BOOL)acceptOnPort:(UInt16)<em>port</em> error:(NSError **)<em>errPtr</em></code></div>
  548. <div class="method-subsection discussion-section">
  549. <h4 class="method-subtitle">Discussion</h4>
  550. <p>Tells the socket to begin listening and accepting connections on the given port.<br/>
  551. When a connection comes in, the AsyncSocket instance will call the various <a href="#//api/name/delegate">delegate</a> methods (see above).<br/>
  552. The socket will listen on all available interfaces (e.g. wifi, ethernet, etc)</p>
  553. </div>
  554. <div class="method-subsection declared-in-section">
  555. <h4 class="method-subtitle">Declared In</h4>
  556. <code class="declared-in-ref">AsyncSocket.h</code><br />
  557. </div>
  558. </div>
  559. <div class="section-method">
  560. <a name="//api/name/addRunLoopMode:" title="addRunLoopMode:"></a>
  561. <h3 class="subsubtitle method-title">addRunLoopMode:</h3>
  562. <div class="method-subsection method-declaration"><code>- (BOOL)addRunLoopMode:(NSString *)<em>runLoopMode</em></code></div>
  563. </div>
  564. <div class="section-method">
  565. <a name="//api/name/canSafelySetDelegate" title="canSafelySetDelegate"></a>
  566. <h3 class="subsubtitle method-title">canSafelySetDelegate</h3>
  567. <div class="method-subsection method-declaration"><code>- (BOOL)canSafelySetDelegate</code></div>
  568. </div>
  569. <div class="section-method">
  570. <a name="//api/name/connectToAddress:error:" title="connectToAddress:error:"></a>
  571. <h3 class="subsubtitle method-title">connectToAddress:error:</h3>
  572. <div class="method-subsection brief-description">
  573. <p>Connects to the given address, specified as a sockaddr structure wrapped in a NSData object.<br/>
  574. For example, a NSData object returned from NSNetService&rsquo;s addresses method.</p>
  575. </div>
  576. <div class="method-subsection method-declaration"><code>- (BOOL)connectToAddress:(NSData *)<em>remoteAddr</em> error:(NSError **)<em>errPtr</em></code></div>
  577. <div class="method-subsection discussion-section">
  578. <h4 class="method-subtitle">Discussion</h4>
  579. <p>Connects to the given address, specified as a sockaddr structure wrapped in a NSData object.<br/>
  580. For example, a NSData object returned from NSNetService&rsquo;s addresses method.</p>
  581. <p>If you have an existing struct sockaddr you can convert it to a NSData object like so:<br/>
  582. struct sockaddr sa -> NSData <em>dsa = [NSData dataWithBytes:&amp;remoteAddr length:remoteAddr.sa_len];<br/>
  583. struct sockaddr </em>sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len];</p>
  584. </div>
  585. <div class="method-subsection declared-in-section">
  586. <h4 class="method-subtitle">Declared In</h4>
  587. <code class="declared-in-ref">AsyncSocket.h</code><br />
  588. </div>
  589. </div>
  590. <div class="section-method">
  591. <a name="//api/name/connectToAddress:viaInterfaceAddress:withTimeout:error:" title="connectToAddress:viaInterfaceAddress:withTimeout:error:"></a>
  592. <h3 class="subsubtitle method-title">connectToAddress:viaInterfaceAddress:withTimeout:error:</h3>
  593. <div class="method-subsection method-declaration"><code>- (BOOL)connectToAddress:(NSData *)<em>remoteAddr</em> viaInterfaceAddress:(NSData *)<em>interfaceAddr</em> withTimeout:(NSTimeInterval)<em>timeout</em> error:(NSError **)<em>errPtr</em></code></div>
  594. </div>
  595. <div class="section-method">
  596. <a name="//api/name/connectToAddress:withTimeout:error:" title="connectToAddress:withTimeout:error:"></a>
  597. <h3 class="subsubtitle method-title">connectToAddress:withTimeout:error:</h3>
  598. <div class="method-subsection brief-description">
  599. <p>This method is the same as <a href="#//api/name/connectToAddress:error:">connectToAddress:error:</a> with an additional timeout option.<br/>
  600. To not time out use a negative time interval, or simply use the <a href="#//api/name/connectToAddress:error:">connectToAddress:error:</a> method.</p>
  601. </div>
  602. <div class="method-subsection method-declaration"><code>- (BOOL)connectToAddress:(NSData *)<em>remoteAddr</em> withTimeout:(NSTimeInterval)<em>timeout</em> error:(NSError **)<em>errPtr</em></code></div>
  603. <div class="method-subsection discussion-section">
  604. <h4 class="method-subtitle">Discussion</h4>
  605. <p>This method is the same as <a href="#//api/name/connectToAddress:error:">connectToAddress:error:</a> with an additional timeout option.<br/>
  606. To not time out use a negative time interval, or simply use the <a href="#//api/name/connectToAddress:error:">connectToAddress:error:</a> method.</p>
  607. </div>
  608. <div class="method-subsection declared-in-section">
  609. <h4 class="method-subtitle">Declared In</h4>
  610. <code class="declared-in-ref">AsyncSocket.h</code><br />
  611. </div>
  612. </div>
  613. <div class="section-method">
  614. <a name="//api/name/connectToHost:onPort:error:" title="connectToHost:onPort:error:"></a>
  615. <h3 class="subsubtitle method-title">connectToHost:onPort:error:</h3>
  616. <div class="method-subsection brief-description">
  617. <p>Connects to the given host and port.<br/>
  618. The host may be a domain name (e.g. &ldquo;deusty.com&rdquo;) or an IP address string (e.g. &ldquo;192.168.0.2&rdquo;)</p>
  619. </div>
  620. <div class="method-subsection method-declaration"><code>- (BOOL)connectToHost:(NSString *)<em>hostname</em> onPort:(UInt16)<em>port</em> error:(NSError **)<em>errPtr</em></code></div>
  621. <div class="method-subsection discussion-section">
  622. <h4 class="method-subtitle">Discussion</h4>
  623. <p>Connects to the given host and port.<br/>
  624. The host may be a domain name (e.g. &ldquo;deusty.com&rdquo;) or an IP address string (e.g. &ldquo;192.168.0.2&rdquo;)</p>
  625. </div>
  626. <div class="method-subsection declared-in-section">
  627. <h4 class="method-subtitle">Declared In</h4>
  628. <code class="declared-in-ref">AsyncSocket.h</code><br />
  629. </div>
  630. </div>
  631. <div class="section-method">
  632. <a name="//api/name/connectToHost:onPort:withTimeout:error:" title="connectToHost:onPort:withTimeout:error:"></a>
  633. <h3 class="subsubtitle method-title">connectToHost:onPort:withTimeout:error:</h3>
  634. <div class="method-subsection brief-description">
  635. <p>This method is the same as <a href="#//api/name/connectToHost:onPort:error:">connectToHost:onPort:error:</a> with an additional timeout option.<br/>
  636. To not time out use a negative time interval, or simply use the <a href="#//api/name/connectToHost:onPort:error:">connectToHost:onPort:error:</a> method.</p>
  637. </div>
  638. <div class="method-subsection method-declaration"><code>- (BOOL)connectToHost:(NSString *)<em>hostname</em> onPort:(UInt16)<em>port</em> withTimeout:(NSTimeInterval)<em>timeout</em> error:(NSError **)<em>errPtr</em></code></div>
  639. <div class="method-subsection discussion-section">
  640. <h4 class="method-subtitle">Discussion</h4>
  641. <p>This method is the same as <a href="#//api/name/connectToHost:onPort:error:">connectToHost:onPort:error:</a> with an additional timeout option.<br/>
  642. To not time out use a negative time interval, or simply use the <a href="#//api/name/connectToHost:onPort:error:">connectToHost:onPort:error:</a> method.</p>
  643. </div>
  644. <div class="method-subsection declared-in-section">
  645. <h4 class="method-subtitle">Declared In</h4>
  646. <code class="declared-in-ref">AsyncSocket.h</code><br />
  647. </div>
  648. </div>
  649. <div class="section-method">
  650. <a name="//api/name/connectedAddress" title="connectedAddress"></a>
  651. <h3 class="subsubtitle method-title">connectedAddress</h3>
  652. <div class="method-subsection brief-description">
  653. <p>Returns the local or remote address to which this socket is connected,<br/>
  654. specified as a sockaddr structure wrapped in a NSData object.</p>
  655. </div>
  656. <div class="method-subsection method-declaration"><code>- (NSData *)connectedAddress</code></div>
  657. <div class="method-subsection discussion-section">
  658. <h4 class="method-subtitle">Discussion</h4>
  659. <p>Returns the local or remote address to which this socket is connected,<br/>
  660. specified as a sockaddr structure wrapped in a NSData object.</p>
  661. <p>See also the <a href="#//api/name/connectedHost">connectedHost</a>, <a href="#//api/name/connectedPort">connectedPort</a>, <a href="#//api/name/localHost">localHost</a> and <a href="#//api/name/localPort">localPort</a> methods.</p>
  662. </div>
  663. <div class="method-subsection declared-in-section">
  664. <h4 class="method-subtitle">Declared In</h4>
  665. <code class="declared-in-ref">AsyncSocket.h</code><br />
  666. </div>
  667. </div>
  668. <div class="section-method">
  669. <a name="//api/name/connectedHost" title="connectedHost"></a>
  670. <h3 class="subsubtitle method-title">connectedHost</h3>
  671. <div class="method-subsection brief-description">
  672. <p>Returns the local or remote host and port to which this socket is connected, or nil and 0 if not connected.<br/>
  673. The host will be an IP address.</p>
  674. </div>
  675. <div class="method-subsection method-declaration"><code>- (NSString *)connectedHost</code></div>
  676. <div class="method-subsection discussion-section">
  677. <h4 class="method-subtitle">Discussion</h4>
  678. <p>Returns the local or remote host and port to which this socket is connected, or nil and 0 if not connected.<br/>
  679. The host will be an IP address.</p>
  680. </div>
  681. <div class="method-subsection declared-in-section">
  682. <h4 class="method-subtitle">Declared In</h4>
  683. <code class="declared-in-ref">AsyncSocket.h</code><br />
  684. </div>
  685. </div>
  686. <div class="section-method">
  687. <a name="//api/name/connectedPort" title="connectedPort"></a>
  688. <h3 class="subsubtitle method-title">connectedPort</h3>
  689. <div class="method-subsection method-declaration"><code>- (UInt16)connectedPort</code></div>
  690. </div>
  691. <div class="section-method">
  692. <a name="//api/name/delegate" title="delegate"></a>
  693. <h3 class="subsubtitle method-title">delegate</h3>
  694. <div class="method-subsection brief-description">
  695. <p>Use &ldquo;canSafelySetDelegate&rdquo; to see if there is any pending business (reads and writes) with the current delegate<br/>
  696. before changing it. It is, of course, safe to change the delegate before connecting or accepting connections.</p>
  697. </div>
  698. <div class="method-subsection method-declaration"><code>- (id)delegate</code></div>
  699. <div class="method-subsection discussion-section">
  700. <h4 class="method-subtitle">Discussion</h4>
  701. <p>Use &ldquo;canSafelySetDelegate&rdquo; to see if there is any pending business (reads and writes) with the current delegate<br/>
  702. before changing it. It is, of course, safe to change the delegate before connecting or accepting connections.</p>
  703. </div>
  704. <div class="method-subsection declared-in-section">
  705. <h4 class="method-subtitle">Declared In</h4>
  706. <code class="declared-in-ref">AsyncSocket.h</code><br />
  707. </div>
  708. </div>
  709. <div class="section-method">
  710. <a name="//api/name/description" title="description"></a>
  711. <h3 class="subsubtitle method-title">description</h3>
  712. <div class="method-subsection method-declaration"><code>- (NSString *)description</code></div>
  713. </div>
  714. <div class="section-method">
  715. <a name="//api/name/disconnect" title="disconnect"></a>
  716. <h3 class="subsubtitle method-title">disconnect</h3>
  717. <div class="method-subsection brief-description">
  718. <p>Disconnects immediately. Any pending reads or writes are dropped.<br/>
  719. If the socket is not already disconnected, the onSocketDidDisconnect <a href="#//api/name/delegate">delegate</a> method<br/>
  720. will be called immediately, before this method returns.</p>
  721. </div>
  722. <div class="method-subsection method-declaration"><code>- (void)disconnect</code></div>
  723. <div class="method-subsection discussion-section">
  724. <h4 class="method-subtitle">Discussion</h4>
  725. <p>Disconnects immediately. Any pending reads or writes are dropped.<br/>
  726. If the socket is not already disconnected, the onSocketDidDisconnect delegate method<br/>
  727. will be called immediately, before this method returns.</p>
  728. <p>Please note the recommended way of releasing an AsyncSocket instance (e.g. in a dealloc method)<br/>
  729. [asyncSocket setDelegate:nil];<br/>
  730. [asyncSocket disconnect];<br/>

Large files files are truncated, but you can click here to view the full file