PageRenderTime 58ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://gitlab.com/mba811/tokaidoapp
HTML | 1995 lines | 1023 code | 972 blank | 0 comment | 0 complexity | 29704a17a6034f3109fdae163273348b 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>AsyncUdpSocket 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">AsyncUdpSocket 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="instance_methods">Instance Methods</option>
  29. <option value="//api/name/bindToAddress:port:error:">&nbsp;&nbsp;&nbsp;&nbsp;- bindToAddress:port:error:</option>
  30. <option value="//api/name/bindToPort:error:">&nbsp;&nbsp;&nbsp;&nbsp;- bindToPort:error:</option>
  31. <option value="//api/name/close">&nbsp;&nbsp;&nbsp;&nbsp;- close</option>
  32. <option value="//api/name/closeAfterReceiving">&nbsp;&nbsp;&nbsp;&nbsp;- closeAfterReceiving</option>
  33. <option value="//api/name/closeAfterSending">&nbsp;&nbsp;&nbsp;&nbsp;- closeAfterSending</option>
  34. <option value="//api/name/closeAfterSendingAndReceiving">&nbsp;&nbsp;&nbsp;&nbsp;- closeAfterSendingAndReceiving</option>
  35. <option value="//api/name/connectToAddress:error:">&nbsp;&nbsp;&nbsp;&nbsp;- connectToAddress:error:</option>
  36. <option value="//api/name/connectToHost:onPort:error:">&nbsp;&nbsp;&nbsp;&nbsp;- connectToHost:onPort:error:</option>
  37. <option value="//api/name/connectedHost">&nbsp;&nbsp;&nbsp;&nbsp;- connectedHost</option>
  38. <option value="//api/name/connectedPort">&nbsp;&nbsp;&nbsp;&nbsp;- connectedPort</option>
  39. <option value="//api/name/delegate">&nbsp;&nbsp;&nbsp;&nbsp;- delegate</option>
  40. <option value="//api/name/enableBroadcast:error:">&nbsp;&nbsp;&nbsp;&nbsp;- enableBroadcast:error:</option>
  41. <option value="//api/name/init">&nbsp;&nbsp;&nbsp;&nbsp;- init</option>
  42. <option value="//api/name/initIPv4">&nbsp;&nbsp;&nbsp;&nbsp;- initIPv4</option>
  43. <option value="//api/name/initIPv6">&nbsp;&nbsp;&nbsp;&nbsp;- initIPv6</option>
  44. <option value="//api/name/initWithDelegate:">&nbsp;&nbsp;&nbsp;&nbsp;- initWithDelegate:</option>
  45. <option value="//api/name/initWithDelegate:userData:">&nbsp;&nbsp;&nbsp;&nbsp;- initWithDelegate:userData:</option>
  46. <option value="//api/name/isClosed">&nbsp;&nbsp;&nbsp;&nbsp;- isClosed</option>
  47. <option value="//api/name/isConnected">&nbsp;&nbsp;&nbsp;&nbsp;- isConnected</option>
  48. <option value="//api/name/isIPv4">&nbsp;&nbsp;&nbsp;&nbsp;- isIPv4</option>
  49. <option value="//api/name/isIPv6">&nbsp;&nbsp;&nbsp;&nbsp;- isIPv6</option>
  50. <option value="//api/name/joinMulticastGroup:error:">&nbsp;&nbsp;&nbsp;&nbsp;- joinMulticastGroup:error:</option>
  51. <option value="//api/name/joinMulticastGroup:withAddress:error:">&nbsp;&nbsp;&nbsp;&nbsp;- joinMulticastGroup:withAddress:error:</option>
  52. <option value="//api/name/localHost">&nbsp;&nbsp;&nbsp;&nbsp;- localHost</option>
  53. <option value="//api/name/localPort">&nbsp;&nbsp;&nbsp;&nbsp;- localPort</option>
  54. <option value="//api/name/maxReceiveBufferSize">&nbsp;&nbsp;&nbsp;&nbsp;- maxReceiveBufferSize</option>
  55. <option value="//api/name/maximumTransmissionUnit">&nbsp;&nbsp;&nbsp;&nbsp;- maximumTransmissionUnit</option>
  56. <option value="//api/name/moveToRunLoop:">&nbsp;&nbsp;&nbsp;&nbsp;- moveToRunLoop:</option>
  57. <option value="//api/name/receiveWithTimeout:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- receiveWithTimeout:tag:</option>
  58. <option value="//api/name/runLoopModes">&nbsp;&nbsp;&nbsp;&nbsp;- runLoopModes</option>
  59. <option value="//api/name/sendData:toAddress:withTimeout:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- sendData:toAddress:withTimeout:tag:</option>
  60. <option value="//api/name/sendData:toHost:port:withTimeout:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- sendData:toHost:port:withTimeout:tag:</option>
  61. <option value="//api/name/sendData:withTimeout:tag:">&nbsp;&nbsp;&nbsp;&nbsp;- sendData:withTimeout:tag:</option>
  62. <option value="//api/name/setDelegate:">&nbsp;&nbsp;&nbsp;&nbsp;- setDelegate:</option>
  63. <option value="//api/name/setMaxReceiveBufferSize:">&nbsp;&nbsp;&nbsp;&nbsp;- setMaxReceiveBufferSize:</option>
  64. <option value="//api/name/setRunLoopModes:">&nbsp;&nbsp;&nbsp;&nbsp;- setRunLoopModes:</option>
  65. <option value="//api/name/setUserData:">&nbsp;&nbsp;&nbsp;&nbsp;- setUserData:</option>
  66. <option value="//api/name/userData">&nbsp;&nbsp;&nbsp;&nbsp;- userData</option>
  67. </select>
  68. </li>
  69. </ul>
  70. </header>
  71. <nav id="tocContainer" class="isShowingTOC">
  72. <ul id="toc" role="tree">
  73. <li role="treeitem" id="task_treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#tasks">Tasks</a></span><ul>
  74. </ul></li>
  75. <li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#instance_methods">Instance Methods</a></span><ul>
  76. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/bindToAddress:port:error:">bindToAddress:port:error:</a></span></li>
  77. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/bindToPort:error:">bindToPort:error:</a></span></li>
  78. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/close">close</a></span></li>
  79. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/closeAfterReceiving">closeAfterReceiving</a></span></li>
  80. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/closeAfterSending">closeAfterSending</a></span></li>
  81. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/closeAfterSendingAndReceiving">closeAfterSendingAndReceiving</a></span></li>
  82. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectToAddress:error:">connectToAddress:error:</a></span></li>
  83. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectToHost:onPort:error:">connectToHost:onPort:error:</a></span></li>
  84. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectedHost">connectedHost</a></span></li>
  85. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectedPort">connectedPort</a></span></li>
  86. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/delegate">delegate</a></span></li>
  87. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/enableBroadcast:error:">enableBroadcast:error:</a></span></li>
  88. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/init">init</a></span></li>
  89. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/initIPv4">initIPv4</a></span></li>
  90. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/initIPv6">initIPv6</a></span></li>
  91. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/initWithDelegate:">initWithDelegate:</a></span></li>
  92. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/initWithDelegate:userData:">initWithDelegate:userData:</a></span></li>
  93. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isClosed">isClosed</a></span></li>
  94. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isConnected">isConnected</a></span></li>
  95. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isIPv4">isIPv4</a></span></li>
  96. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isIPv6">isIPv6</a></span></li>
  97. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/joinMulticastGroup:error:">joinMulticastGroup:error:</a></span></li>
  98. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/joinMulticastGroup:withAddress:error:">joinMulticastGroup:withAddress:error:</a></span></li>
  99. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/localHost">localHost</a></span></li>
  100. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/localPort">localPort</a></span></li>
  101. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/maxReceiveBufferSize">maxReceiveBufferSize</a></span></li>
  102. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/maximumTransmissionUnit">maximumTransmissionUnit</a></span></li>
  103. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/moveToRunLoop:">moveToRunLoop:</a></span></li>
  104. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/receiveWithTimeout:tag:">receiveWithTimeout:tag:</a></span></li>
  105. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/runLoopModes">runLoopModes</a></span></li>
  106. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/sendData:toAddress:withTimeout:tag:">sendData:toAddress:withTimeout:tag:</a></span></li>
  107. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/sendData:toHost:port:withTimeout:tag:">sendData:toHost:port:withTimeout:tag:</a></span></li>
  108. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/sendData:withTimeout:tag:">sendData:withTimeout:tag:</a></span></li>
  109. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setDelegate:">setDelegate:</a></span></li>
  110. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setMaxReceiveBufferSize:">setMaxReceiveBufferSize:</a></span></li>
  111. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setRunLoopModes:">setRunLoopModes:</a></span></li>
  112. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setUserData:">setUserData:</a></span></li>
  113. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/userData">userData</a></span></li>
  114. </ul></li>
  115. </ul>
  116. </nav>
  117. <article>
  118. <div id="contents" class="isShowingTOC" role="main">
  119. <a title="AsyncUdpSocket Class Reference" name="top"></a>
  120. <div class="main-navigation navigation-top">
  121. <ul>
  122. <li><a href="../index.html">Index</a></li>
  123. <li><a href="../hierarchy.html">Hierarchy</a></li>
  124. </ul>
  125. </div>
  126. <div id="header">
  127. <div class="section-header">
  128. <h1 class="title title-header">AsyncUdpSocket Class Reference</h1>
  129. </div>
  130. </div>
  131. <div id="container">
  132. <div class="section section-specification"><table cellspacing="0"><tbody>
  133. <tr>
  134. <td class="specification-title">Inherits from</td>
  135. <td class="specification-value">NSObject</td>
  136. </tr><tr>
  137. <td class="specification-title">Declared in</td>
  138. <td class="specification-value">AsyncUdpSocket.h</td>
  139. </tr>
  140. </tbody></table></div>
  141. <div class="section section-tasks">
  142. <a title="Tasks" name="tasks"></a>
  143. <h2 class="subtitle subtitle-tasks">Tasks</h2>
  144. <ul class="task-list">
  145. <li>
  146. <span class="tooltip">
  147. <code><a href="#//api/name/init">&ndash;&nbsp;init</a></code>
  148. <span class="tooltip"><p>Creates new instances of AsyncUdpSocket.</p></span>
  149. </span>
  150. </li><li>
  151. <span class="tooltip">
  152. <code><a href="#//api/name/initWithDelegate:">&ndash;&nbsp;initWithDelegate:</a></code>
  153. </span>
  154. </li><li>
  155. <span class="tooltip">
  156. <code><a href="#//api/name/initWithDelegate:userData:">&ndash;&nbsp;initWithDelegate:userData:</a></code>
  157. </span>
  158. </li><li>
  159. <span class="tooltip">
  160. <code><a href="#//api/name/initIPv4">&ndash;&nbsp;initIPv4</a></code>
  161. <span class="tooltip"><p>Creates new instances of AsyncUdpSocket that support only IPv4 or IPv6.<br/>
  162. The other <a href="#//api/name/init">init</a> methods will support both, unless specifically binded or connected to one protocol.<br/>
  163. If you know you&rsquo;ll only be using one protocol, these <a href="#//api/name/init">init</a> methods may be a bit more efficient.</p></span>
  164. </span>
  165. </li><li>
  166. <span class="tooltip">
  167. <code><a href="#//api/name/initIPv6">&ndash;&nbsp;initIPv6</a></code>
  168. </span>
  169. </li><li>
  170. <span class="tooltip">
  171. <code><a href="#//api/name/delegate">&ndash;&nbsp;delegate</a></code>
  172. </span>
  173. </li><li>
  174. <span class="tooltip">
  175. <code><a href="#//api/name/setDelegate:">&ndash;&nbsp;setDelegate:</a></code>
  176. </span>
  177. </li><li>
  178. <span class="tooltip">
  179. <code><a href="#//api/name/userData">&ndash;&nbsp;userData</a></code>
  180. </span>
  181. </li><li>
  182. <span class="tooltip">
  183. <code><a href="#//api/name/setUserData:">&ndash;&nbsp;setUserData:</a></code>
  184. </span>
  185. </li><li>
  186. <span class="tooltip">
  187. <code><a href="#//api/name/localHost">&ndash;&nbsp;localHost</a></code>
  188. <span class="tooltip"><p>Returns the local address info for the socket.</p></span>
  189. </span>
  190. </li><li>
  191. <span class="tooltip">
  192. <code><a href="#//api/name/localPort">&ndash;&nbsp;localPort</a></code>
  193. </span>
  194. </li><li>
  195. <span class="tooltip">
  196. <code><a href="#//api/name/connectedHost">&ndash;&nbsp;connectedHost</a></code>
  197. <span class="tooltip"><p>Returns the remote address info for the socket.</p></span>
  198. </span>
  199. </li><li>
  200. <span class="tooltip">
  201. <code><a href="#//api/name/connectedPort">&ndash;&nbsp;connectedPort</a></code>
  202. </span>
  203. </li><li>
  204. <span class="tooltip">
  205. <code><a href="#//api/name/isConnected">&ndash;&nbsp;isConnected</a></code>
  206. <span class="tooltip"><p>Returns whether or not this socket has been connected to a single host.<br/>
  207. By design, UDP is a connectionless protocol, and connecting is not needed.<br/>
  208. If connected, the socket will only be able to send/receive data to/from the connected host.</p></span>
  209. </span>
  210. </li><li>
  211. <span class="tooltip">
  212. <code><a href="#//api/name/isClosed">&ndash;&nbsp;isClosed</a></code>
  213. <span class="tooltip"><p>Returns whether or not this socket has been closed.<br/>
  214. The only way a socket can be closed is if you explicitly call one of the <a href="#//api/name/close">close</a> methods.</p></span>
  215. </span>
  216. </li><li>
  217. <span class="tooltip">
  218. <code><a href="#//api/name/isIPv4">&ndash;&nbsp;isIPv4</a></code>
  219. <span class="tooltip"><p>Returns whether or not this socket supports IPv4.<br/>
  220. By default this will be true, unless the socket is specifically initialized as IPv6 only,<br/>
  221. or is binded or connected to an IPv6 address.</p></span>
  222. </span>
  223. </li><li>
  224. <span class="tooltip">
  225. <code><a href="#//api/name/isIPv6">&ndash;&nbsp;isIPv6</a></code>
  226. <span class="tooltip"><p>Returns whether or not this socket supports IPv6.<br/>
  227. By default this will be true, unless the socket is specifically initialized as IPv4 only,<br/>
  228. or is binded or connected to an IPv4 address.</p></span>
  229. </span>
  230. </li><li>
  231. <span class="tooltip">
  232. <code><a href="#//api/name/maximumTransmissionUnit">&ndash;&nbsp;maximumTransmissionUnit</a></code>
  233. <span class="tooltip"><p>Returns the mtu of the socket.<br/>
  234. If unknown, returns zero.</p></span>
  235. </span>
  236. </li><li>
  237. <span class="tooltip">
  238. <code><a href="#//api/name/bindToPort:error:">&ndash;&nbsp;bindToPort:error:</a></code>
  239. <span class="tooltip"><p>Binds the UDP socket to the given port and optional address.<br/>
  240. Binding should be done for server sockets that receive data prior to sending it.<br/>
  241. Client sockets can skip binding,<br/>
  242. as the OS will automatically assign the socket an available port when it starts sending data.</p></span>
  243. </span>
  244. </li><li>
  245. <span class="tooltip">
  246. <code><a href="#//api/name/bindToAddress:port:error:">&ndash;&nbsp;bindToAddress:port:error:</a></code>
  247. </span>
  248. </li><li>
  249. <span class="tooltip">
  250. <code><a href="#//api/name/connectToHost:onPort:error:">&ndash;&nbsp;connectToHost:onPort:error:</a></code>
  251. <span class="tooltip"><p>Connects the UDP socket to the given host and port.<br/>
  252. By design, UDP is a connectionless protocol, and connecting is not needed.</p></span>
  253. </span>
  254. </li><li>
  255. <span class="tooltip">
  256. <code><a href="#//api/name/connectToAddress:error:">&ndash;&nbsp;connectToAddress:error:</a></code>
  257. </span>
  258. </li><li>
  259. <span class="tooltip">
  260. <code><a href="#//api/name/joinMulticastGroup:error:">&ndash;&nbsp;joinMulticastGroup:error:</a></code>
  261. <span class="tooltip"><p>Join multicast group</p></span>
  262. </span>
  263. </li><li>
  264. <span class="tooltip">
  265. <code><a href="#//api/name/joinMulticastGroup:withAddress:error:">&ndash;&nbsp;joinMulticastGroup:withAddress:error:</a></code>
  266. </span>
  267. </li><li>
  268. <span class="tooltip">
  269. <code><a href="#//api/name/enableBroadcast:error:">&ndash;&nbsp;enableBroadcast:error:</a></code>
  270. <span class="tooltip"><p>By default, the underlying socket in the OS will not allow you to send broadcast messages.<br/>
  271. In order to send broadcast messages, you need to enable this functionality in the socket.</p></span>
  272. </span>
  273. </li><li>
  274. <span class="tooltip">
  275. <code><a href="#//api/name/sendData:withTimeout:tag:">&ndash;&nbsp;sendData:withTimeout:tag:</a></code>
  276. <span class="tooltip"><p>Asynchronously sends the given data, with the given timeout and tag.</p></span>
  277. </span>
  278. </li><li>
  279. <span class="tooltip">
  280. <code><a href="#//api/name/sendData:toHost:port:withTimeout:tag:">&ndash;&nbsp;sendData:toHost:port:withTimeout:tag:</a></code>
  281. <span class="tooltip"><p>Asynchronously sends the given data, with the given timeout and tag, to the given host and port.</p></span>
  282. </span>
  283. </li><li>
  284. <span class="tooltip">
  285. <code><a href="#//api/name/sendData:toAddress:withTimeout:tag:">&ndash;&nbsp;sendData:toAddress:withTimeout:tag:</a></code>
  286. <span class="tooltip"><p>Asynchronously sends the given data, with the given timeout and tag, to the given address.</p></span>
  287. </span>
  288. </li><li>
  289. <span class="tooltip">
  290. <code><a href="#//api/name/receiveWithTimeout:tag:">&ndash;&nbsp;receiveWithTimeout:tag:</a></code>
  291. <span class="tooltip"><p>Asynchronously receives a single datagram packet.</p></span>
  292. </span>
  293. </li><li>
  294. <span class="tooltip">
  295. <code><a href="#//api/name/close">&ndash;&nbsp;close</a></code>
  296. <span class="tooltip"><p>Closes the socket immediately. Any pending send or receive operations are dropped.</p></span>
  297. </span>
  298. </li><li>
  299. <span class="tooltip">
  300. <code><a href="#//api/name/closeAfterSending">&ndash;&nbsp;closeAfterSending</a></code>
  301. <span class="tooltip"><p>Closes after all pending send operations have completed.<br/>
  302. After calling this, the sendData: and receive: methods will do nothing.<br/>
  303. In other words, you won&rsquo;t be able to add any more send or receive operations to the queue.<br/>
  304. The socket will <a href="#//api/name/close">close</a> even if there are still pending receive operations.</p></span>
  305. </span>
  306. </li><li>
  307. <span class="tooltip">
  308. <code><a href="#//api/name/closeAfterReceiving">&ndash;&nbsp;closeAfterReceiving</a></code>
  309. <span class="tooltip"><p>Closes after all pending receive operations have completed.<br/>
  310. After calling this, the sendData: and receive: methods will do nothing.<br/>
  311. In other words, you won&rsquo;t be able to add any more send or receive operations to the queue.<br/>
  312. The socket will <a href="#//api/name/close">close</a> even if there are still pending send operations.</p></span>
  313. </span>
  314. </li><li>
  315. <span class="tooltip">
  316. <code><a href="#//api/name/closeAfterSendingAndReceiving">&ndash;&nbsp;closeAfterSendingAndReceiving</a></code>
  317. <span class="tooltip"><p>Closes after all pending send and receive operations have completed.<br/>
  318. After calling this, the sendData: and receive: methods will do nothing.<br/>
  319. In other words, you won&rsquo;t be able to add any more send or receive operations to the queue.</p></span>
  320. </span>
  321. </li><li>
  322. <span class="tooltip">
  323. <code><a href="#//api/name/maxReceiveBufferSize">&ndash;&nbsp;maxReceiveBufferSize</a></code>
  324. <span class="tooltip"><p>Gets/Sets the maximum size of the buffer that will be allocated for receive operations.<br/>
  325. The default size is 9216 bytes.</p></span>
  326. </span>
  327. </li><li>
  328. <span class="tooltip">
  329. <code><a href="#//api/name/setMaxReceiveBufferSize:">&ndash;&nbsp;setMaxReceiveBufferSize:</a></code>
  330. </span>
  331. </li><li>
  332. <span class="tooltip">
  333. <code><a href="#//api/name/moveToRunLoop:">&ndash;&nbsp;moveToRunLoop:</a></code>
  334. <span class="tooltip"><p>When you create an AsyncUdpSocket, it is added to the runloop of the current thread.<br/>
  335. So it is easiest to simply create the socket on the thread you intend to use it.</p></span>
  336. </span>
  337. </li><li>
  338. <span class="tooltip">
  339. <code><a href="#//api/name/setRunLoopModes:">&ndash;&nbsp;setRunLoopModes:</a></code>
  340. <span class="tooltip"><p>Allows you to configure which run loop modes the socket uses.<br/>
  341. The default set of run loop modes is NSDefaultRunLoopMode.</p></span>
  342. </span>
  343. </li><li>
  344. <span class="tooltip">
  345. <code><a href="#//api/name/runLoopModes">&ndash;&nbsp;runLoopModes</a></code>
  346. <span class="tooltip"><p>Returns the current run loop modes the <a href="../Classes/AsyncSocket.html">AsyncSocket</a> instance is operating in.<br/>
  347. The default set of run loop modes is NSDefaultRunLoopMode.</p></span>
  348. </span>
  349. </li>
  350. </ul>
  351. </div>
  352. <div class="section section-methods">
  353. <a title="Instance Methods" name="instance_methods"></a>
  354. <h2 class="subtitle subtitle-methods">Instance Methods</h2>
  355. <div class="section-method">
  356. <a name="//api/name/bindToAddress:port:error:" title="bindToAddress:port:error:"></a>
  357. <h3 class="subsubtitle method-title">bindToAddress:port:error:</h3>
  358. <div class="method-subsection method-declaration"><code>- (BOOL)bindToAddress:(NSString *)<em>localAddr</em> port:(UInt16)<em>port</em> error:(NSError **)<em>errPtr</em></code></div>
  359. </div>
  360. <div class="section-method">
  361. <a name="//api/name/bindToPort:error:" title="bindToPort:error:"></a>
  362. <h3 class="subsubtitle method-title">bindToPort:error:</h3>
  363. <div class="method-subsection brief-description">
  364. <p>Binds the UDP socket to the given port and optional address.<br/>
  365. Binding should be done for server sockets that receive data prior to sending it.<br/>
  366. Client sockets can skip binding,<br/>
  367. as the OS will automatically assign the socket an available port when it starts sending data.</p>
  368. </div>
  369. <div class="method-subsection method-declaration"><code>- (BOOL)bindToPort:(UInt16)<em>port</em> error:(NSError **)<em>errPtr</em></code></div>
  370. <div class="method-subsection discussion-section">
  371. <h4 class="method-subtitle">Discussion</h4>
  372. <p>Binds the UDP socket to the given port and optional address.<br/>
  373. Binding should be done for server sockets that receive data prior to sending it.<br/>
  374. Client sockets can skip binding,<br/>
  375. as the OS will automatically assign the socket an available port when it starts sending data.</p>
  376. <p>You cannot bind a socket after its been connected.<br/>
  377. You can only bind a socket once.<br/>
  378. You can still connect a socket (if desired) after binding.</p>
  379. <p>On success, returns YES.<br/>
  380. Otherwise returns NO, and sets errPtr. If you don&rsquo;t care about the error, you can pass nil for errPtr.</p>
  381. </div>
  382. <div class="method-subsection declared-in-section">
  383. <h4 class="method-subtitle">Declared In</h4>
  384. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  385. </div>
  386. </div>
  387. <div class="section-method">
  388. <a name="//api/name/close" title="close"></a>
  389. <h3 class="subsubtitle method-title">close</h3>
  390. <div class="method-subsection brief-description">
  391. <p>Closes the socket immediately. Any pending send or receive operations are dropped.</p>
  392. </div>
  393. <div class="method-subsection method-declaration"><code>- (void)close</code></div>
  394. <div class="method-subsection discussion-section">
  395. <h4 class="method-subtitle">Discussion</h4>
  396. <p>Closes the socket immediately. Any pending send or receive operations are dropped.</p>
  397. </div>
  398. <div class="method-subsection declared-in-section">
  399. <h4 class="method-subtitle">Declared In</h4>
  400. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  401. </div>
  402. </div>
  403. <div class="section-method">
  404. <a name="//api/name/closeAfterReceiving" title="closeAfterReceiving"></a>
  405. <h3 class="subsubtitle method-title">closeAfterReceiving</h3>
  406. <div class="method-subsection brief-description">
  407. <p>Closes after all pending receive operations have completed.<br/>
  408. After calling this, the sendData: and receive: methods will do nothing.<br/>
  409. In other words, you won&rsquo;t be able to add any more send or receive operations to the queue.<br/>
  410. The socket will <a href="#//api/name/close">close</a> even if there are still pending send operations.</p>
  411. </div>
  412. <div class="method-subsection method-declaration"><code>- (void)closeAfterReceiving</code></div>
  413. <div class="method-subsection discussion-section">
  414. <h4 class="method-subtitle">Discussion</h4>
  415. <p>Closes after all pending receive operations have completed.<br/>
  416. After calling this, the sendData: and receive: methods will do nothing.<br/>
  417. In other words, you won&rsquo;t be able to add any more send or receive operations to the queue.<br/>
  418. The socket will <a href="#//api/name/close">close</a> even if there are still pending send operations.</p>
  419. </div>
  420. <div class="method-subsection declared-in-section">
  421. <h4 class="method-subtitle">Declared In</h4>
  422. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  423. </div>
  424. </div>
  425. <div class="section-method">
  426. <a name="//api/name/closeAfterSending" title="closeAfterSending"></a>
  427. <h3 class="subsubtitle method-title">closeAfterSending</h3>
  428. <div class="method-subsection brief-description">
  429. <p>Closes after all pending send operations have completed.<br/>
  430. After calling this, the sendData: and receive: methods will do nothing.<br/>
  431. In other words, you won&rsquo;t be able to add any more send or receive operations to the queue.<br/>
  432. The socket will <a href="#//api/name/close">close</a> even if there are still pending receive operations.</p>
  433. </div>
  434. <div class="method-subsection method-declaration"><code>- (void)closeAfterSending</code></div>
  435. <div class="method-subsection discussion-section">
  436. <h4 class="method-subtitle">Discussion</h4>
  437. <p>Closes after all pending send operations have completed.<br/>
  438. After calling this, the sendData: and receive: methods will do nothing.<br/>
  439. In other words, you won&rsquo;t be able to add any more send or receive operations to the queue.<br/>
  440. The socket will <a href="#//api/name/close">close</a> even if there are still pending receive operations.</p>
  441. </div>
  442. <div class="method-subsection declared-in-section">
  443. <h4 class="method-subtitle">Declared In</h4>
  444. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  445. </div>
  446. </div>
  447. <div class="section-method">
  448. <a name="//api/name/closeAfterSendingAndReceiving" title="closeAfterSendingAndReceiving"></a>
  449. <h3 class="subsubtitle method-title">closeAfterSendingAndReceiving</h3>
  450. <div class="method-subsection brief-description">
  451. <p>Closes after all pending send and receive operations have completed.<br/>
  452. After calling this, the sendData: and receive: methods will do nothing.<br/>
  453. In other words, you won&rsquo;t be able to add any more send or receive operations to the queue.</p>
  454. </div>
  455. <div class="method-subsection method-declaration"><code>- (void)closeAfterSendingAndReceiving</code></div>
  456. <div class="method-subsection discussion-section">
  457. <h4 class="method-subtitle">Discussion</h4>
  458. <p>Closes after all pending send and receive operations have completed.<br/>
  459. After calling this, the sendData: and receive: methods will do nothing.<br/>
  460. In other words, you won&rsquo;t be able to add any more send or receive operations to the queue.</p>
  461. </div>
  462. <div class="method-subsection declared-in-section">
  463. <h4 class="method-subtitle">Declared In</h4>
  464. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  465. </div>
  466. </div>
  467. <div class="section-method">
  468. <a name="//api/name/connectToAddress:error:" title="connectToAddress:error:"></a>
  469. <h3 class="subsubtitle method-title">connectToAddress:error:</h3>
  470. <div class="method-subsection method-declaration"><code>- (BOOL)connectToAddress:(NSData *)<em>remoteAddr</em> error:(NSError **)<em>errPtr</em></code></div>
  471. </div>
  472. <div class="section-method">
  473. <a name="//api/name/connectToHost:onPort:error:" title="connectToHost:onPort:error:"></a>
  474. <h3 class="subsubtitle method-title">connectToHost:onPort:error:</h3>
  475. <div class="method-subsection brief-description">
  476. <p>Connects the UDP socket to the given host and port.<br/>
  477. By design, UDP is a connectionless protocol, and connecting is not needed.</p>
  478. </div>
  479. <div class="method-subsection method-declaration"><code>- (BOOL)connectToHost:(NSString *)<em>host</em> onPort:(UInt16)<em>port</em> error:(NSError **)<em>errPtr</em></code></div>
  480. <div class="method-subsection discussion-section">
  481. <h4 class="method-subtitle">Discussion</h4>
  482. <p>Connects the UDP socket to the given host and port.<br/>
  483. By design, UDP is a connectionless protocol, and connecting is not needed.</p>
  484. <p>Choosing to connect to a specific host/port has the following effect:<br/>
  485. - You will only be able to send data to the connected host/port.<br/>
  486. - You will only be able to receive data from the connected host/port.<br/>
  487. - You will receive ICMP messages that come from the connected host/port, such as &ldquo;connection refused&rdquo;.</p>
  488. <p>Connecting a UDP socket does not result in any communication on the socket.<br/>
  489. It simply changes the internal state of the socket.</p>
  490. <p>You cannot bind a socket after its been connected.<br/>
  491. You can only connect a socket once.</p>
  492. <p>On success, returns YES.<br/>
  493. Otherwise returns NO, and sets errPtr. If you don&rsquo;t care about the error, you can pass nil for errPtr.</p>
  494. </div>
  495. <div class="method-subsection declared-in-section">
  496. <h4 class="method-subtitle">Declared In</h4>
  497. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  498. </div>
  499. </div>
  500. <div class="section-method">
  501. <a name="//api/name/connectedHost" title="connectedHost"></a>
  502. <h3 class="subsubtitle method-title">connectedHost</h3>
  503. <div class="method-subsection brief-description">
  504. <p>Returns the remote address info for the socket.</p>
  505. </div>
  506. <div class="method-subsection method-declaration"><code>- (NSString *)connectedHost</code></div>
  507. <div class="method-subsection discussion-section">
  508. <h4 class="method-subtitle">Discussion</h4>
  509. <p>Returns the remote address info for the socket.</p>
  510. <p>Note: Since UDP is connectionless by design, connected address info<br/>
  511. will not be available unless the socket is explicitly connected to a remote host/port</p>
  512. </div>
  513. <div class="method-subsection declared-in-section">
  514. <h4 class="method-subtitle">Declared In</h4>
  515. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  516. </div>
  517. </div>
  518. <div class="section-method">
  519. <a name="//api/name/connectedPort" title="connectedPort"></a>
  520. <h3 class="subsubtitle method-title">connectedPort</h3>
  521. <div class="method-subsection method-declaration"><code>- (UInt16)connectedPort</code></div>
  522. </div>
  523. <div class="section-method">
  524. <a name="//api/name/delegate" title="delegate"></a>
  525. <h3 class="subsubtitle method-title">delegate</h3>
  526. <div class="method-subsection method-declaration"><code>- (id)delegate</code></div>
  527. </div>
  528. <div class="section-method">
  529. <a name="//api/name/enableBroadcast:error:" title="enableBroadcast:error:"></a>
  530. <h3 class="subsubtitle method-title">enableBroadcast:error:</h3>
  531. <div class="method-subsection brief-description">
  532. <p>By default, the underlying socket in the OS will not allow you to send broadcast messages.<br/>
  533. In order to send broadcast messages, you need to enable this functionality in the socket.</p>
  534. </div>
  535. <div class="method-subsection method-declaration"><code>- (BOOL)enableBroadcast:(BOOL)<em>flag</em> error:(NSError **)<em>errPtr</em></code></div>
  536. <div class="method-subsection discussion-section">
  537. <h4 class="method-subtitle">Discussion</h4>
  538. <p>By default, the underlying socket in the OS will not allow you to send broadcast messages.<br/>
  539. In order to send broadcast messages, you need to enable this functionality in the socket.</p>
  540. <p>A broadcast is a UDP message to addresses like &ldquo;192.168.255.255&rdquo; or &ldquo;255.255.255.255&rdquo; that is<br/>
  541. delivered to every host on the network.<br/>
  542. The reason this is generally disabled by default is to prevent<br/>
  543. accidental broadcast messages from flooding the network.</p>
  544. </div>
  545. <div class="method-subsection declared-in-section">
  546. <h4 class="method-subtitle">Declared In</h4>
  547. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  548. </div>
  549. </div>
  550. <div class="section-method">
  551. <a name="//api/name/init" title="init"></a>
  552. <h3 class="subsubtitle method-title">init</h3>
  553. <div class="method-subsection brief-description">
  554. <p>Creates new instances of AsyncUdpSocket.</p>
  555. </div>
  556. <div class="method-subsection method-declaration"><code>- (id)init</code></div>
  557. <div class="method-subsection discussion-section">
  558. <h4 class="method-subtitle">Discussion</h4>
  559. <p>Creates new instances of AsyncUdpSocket.</p>
  560. </div>
  561. <div class="method-subsection declared-in-section">
  562. <h4 class="method-subtitle">Declared In</h4>
  563. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  564. </div>
  565. </div>
  566. <div class="section-method">
  567. <a name="//api/name/initIPv4" title="initIPv4"></a>
  568. <h3 class="subsubtitle method-title">initIPv4</h3>
  569. <div class="method-subsection brief-description">
  570. <p>Creates new instances of AsyncUdpSocket that support only IPv4 or IPv6.<br/>
  571. The other <a href="#//api/name/init">init</a> methods will support both, unless specifically binded or connected to one protocol.<br/>
  572. If you know you&rsquo;ll only be using one protocol, these <a href="#//api/name/init">init</a> methods may be a bit more efficient.</p>
  573. </div>
  574. <div class="method-subsection method-declaration"><code>- (id)initIPv4</code></div>
  575. <div class="method-subsection discussion-section">
  576. <h4 class="method-subtitle">Discussion</h4>
  577. <p>Creates new instances of AsyncUdpSocket that support only IPv4 or IPv6.<br/>
  578. The other <a href="#//api/name/init">init</a> methods will support both, unless specifically binded or connected to one protocol.<br/>
  579. If you know you&rsquo;ll only be using one protocol, these <a href="#//api/name/init">init</a> methods may be a bit more efficient.</p>
  580. </div>
  581. <div class="method-subsection declared-in-section">
  582. <h4 class="method-subtitle">Declared In</h4>
  583. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  584. </div>
  585. </div>
  586. <div class="section-method">
  587. <a name="//api/name/initIPv6" title="initIPv6"></a>
  588. <h3 class="subsubtitle method-title">initIPv6</h3>
  589. <div class="method-subsection method-declaration"><code>- (id)initIPv6</code></div>
  590. </div>
  591. <div class="section-method">
  592. <a name="//api/name/initWithDelegate:" title="initWithDelegate:"></a>
  593. <h3 class="subsubtitle method-title">initWithDelegate:</h3>
  594. <div class="method-subsection method-declaration"><code>- (id)initWithDelegate:(id)<em>delegate</em></code></div>
  595. </div>
  596. <div class="section-method">
  597. <a name="//api/name/initWithDelegate:userData:" title="initWithDelegate:userData:"></a>
  598. <h3 class="subsubtitle method-title">initWithDelegate:userData:</h3>
  599. <div class="method-subsection method-declaration"><code>- (id)initWithDelegate:(id)<em>delegate</em> userData:(long)<em>userData</em></code></div>
  600. </div>
  601. <div class="section-method">
  602. <a name="//api/name/isClosed" title="isClosed"></a>
  603. <h3 class="subsubtitle method-title">isClosed</h3>
  604. <div class="method-subsection brief-description">
  605. <p>Returns whether or not this socket has been closed.<br/>
  606. The only way a socket can be closed is if you explicitly call one of the <a href="#//api/name/close">close</a> methods.</p>
  607. </div>
  608. <div class="method-subsection method-declaration"><code>- (BOOL)isClosed</code></div>
  609. <div class="method-subsection discussion-section">
  610. <h4 class="method-subtitle">Discussion</h4>
  611. <p>Returns whether or not this socket has been closed.<br/>
  612. The only way a socket can be closed is if you explicitly call one of the <a href="#//api/name/close">close</a> methods.</p>
  613. </div>
  614. <div class="method-subsection declared-in-section">
  615. <h4 class="method-subtitle">Declared In</h4>
  616. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  617. </div>
  618. </div>
  619. <div class="section-method">
  620. <a name="//api/name/isConnected" title="isConnected"></a>
  621. <h3 class="subsubtitle method-title">isConnected</h3>
  622. <div class="method-subsection brief-description">
  623. <p>Returns whether or not this socket has been connected to a single host.<br/>
  624. By design, UDP is a connectionless protocol, and connecting is not needed.<br/>
  625. If connected, the socket will only be able to send/receive data to/from the connected host.</p>
  626. </div>
  627. <div class="method-subsection method-declaration"><code>- (BOOL)isConnected</code></div>
  628. <div class="method-subsection discussion-section">
  629. <h4 class="method-subtitle">Discussion</h4>
  630. <p>Returns whether or not this socket has been connected to a single host.<br/>
  631. By design, UDP is a connectionless protocol, and connecting is not needed.<br/>
  632. If connected, the socket will only be able to send/receive data to/from the connected host.</p>
  633. </div>
  634. <div class="method-subsection declared-in-section">
  635. <h4 class="method-subtitle">Declared In</h4>
  636. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  637. </div>
  638. </div>
  639. <div class="section-method">
  640. <a name="//api/name/isIPv4" title="isIPv4"></a>
  641. <h3 class="subsubtitle method-title">isIPv4</h3>
  642. <div class="method-subsection brief-description">
  643. <p>Returns whether or not this socket supports IPv4.<br/>
  644. By default this will be true, unless the socket is specifically initialized as IPv6 only,<br/>
  645. or is binded or connected to an IPv6 address.</p>
  646. </div>
  647. <div class="method-subsection method-declaration"><code>- (BOOL)isIPv4</code></div>
  648. <div class="method-subsection discussion-section">
  649. <h4 class="method-subtitle">Discussion</h4>
  650. <p>Returns whether or not this socket supports IPv4.<br/>
  651. By default this will be true, unless the socket is specifically initialized as IPv6 only,<br/>
  652. or is binded or connected to an IPv6 address.</p>
  653. </div>
  654. <div class="method-subsection declared-in-section">
  655. <h4 class="method-subtitle">Declared In</h4>
  656. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  657. </div>
  658. </div>
  659. <div class="section-method">
  660. <a name="//api/name/isIPv6" title="isIPv6"></a>
  661. <h3 class="subsubtitle method-title">isIPv6</h3>
  662. <div class="method-subsection brief-description">
  663. <p>Returns whether or not this socket supports IPv6.<br/>
  664. By default this will be true, unless the socket is specifically initialized as IPv4 only,<br/>
  665. or is binded or connected to an IPv4 address.</p>
  666. </div>
  667. <div class="method-subsection method-declaration"><code>- (BOOL)isIPv6</code></div>
  668. <div class="method-subsection discussion-section">
  669. <h4 class="method-subtitle">Discussion</h4>
  670. <p>Returns whether or not this socket supports IPv6.<br/>
  671. By default this will be true, unless the socket is specifically initialized as IPv4 only,<br/>
  672. or is binded or connected to an IPv4 address.</p>
  673. <p>This method will also return false on platforms that do not support IPv6.<br/>
  674. Note: The iPhone does not currently support IPv6.</p>
  675. </div>
  676. <div class="method-subsection declared-in-section">
  677. <h4 class="method-subtitle">Declared In</h4>
  678. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  679. </div>
  680. </div>
  681. <div class="section-method">
  682. <a name="//api/name/joinMulticastGroup:error:" title="joinMulticastGroup:error:"></a>
  683. <h3 class="subsubtitle method-title">joinMulticastGroup:error:</h3>
  684. <div class="method-subsection brief-description">
  685. <p>Join multicast group</p>
  686. </div>
  687. <div class="method-subsection method-declaration"><code>- (BOOL)joinMulticastGroup:(NSString *)<em>group</em> error:(NSError **)<em>errPtr</em></code></div>
  688. <div class="method-subsection discussion-section">
  689. <h4 class="method-subtitle">Discussion</h4>
  690. <p>Join multicast group</p>
  691. <p>Group should be an IP address (eg @&ldquo;225.228.0.1&rdquo;)</p>
  692. </div>
  693. <div class="method-subsection declared-in-section">
  694. <h4 class="method-subtitle">Declared In</h4>
  695. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  696. </div>
  697. </div>
  698. <div class="section-method">
  699. <a name="//api/name/joinMulticastGroup:withAddress:error:" title="joinMulticastGroup:withAddress:error:"></a>
  700. <h3 class="subsubtitle method-title">joinMulticastGroup:withAddress:error:</h3>
  701. <div class="method-subsection method-declaration"><code>- (BOOL)joinMulticastGroup:(NSString *)<em>group</em> withAddress:(NSString *)<em>interface</em> error:(NSError **)<em>errPtr</em></code></div>
  702. </div>
  703. <div class="section-method">
  704. <a name="//api/name/localHost" title="localHost"></a>
  705. <h3 class="subsubtitle method-title">localHost</h3>
  706. <div class="method-subsection brief-description">
  707. <p>Returns the local address info for the socket.</p>
  708. </div>
  709. <div class="method-subsection method-declaration"><code>- (NSString *)localHost</code></div>
  710. <div class="method-subsection discussion-section">
  711. <h4 class="method-subtitle">Discussion</h4>
  712. <p>Returns the local address info for the socket.</p>
  713. <p>Note: Address info may not be available until after the socket has been bind'ed,<br/>
  714. or until after data has been sent.</p>
  715. </div>
  716. <div class="method-subsection declared-in-section">
  717. <h4 class="method-subtitle">Declared In</h4>
  718. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  719. </div>
  720. </div>
  721. <div class="section-method">
  722. <a name="//api/name/localPort" title="localPort"></a>
  723. <h3 class="subsubtitle method-title">localPort</h3>
  724. <div class="method-subsection method-declaration"><code>- (UInt16)localPort</code></div>
  725. </div>
  726. <div class="section-method">
  727. <a name="//api/name/maxReceiveBufferSize" title="maxReceiveBufferSize"></a>
  728. <h3 class="subsubtitle method-title">maxReceiveBufferSize</h3>
  729. <div class="method-subsection brief-description">
  730. <p>Gets/Sets the maximum size of the buffer that will be allocated for receive operations.<br/>
  731. The default size is 9216 bytes.</p>
  732. </div>
  733. <div class="method-subsection method-declaration"><code>- (UInt32)maxReceiveBufferSize</code></div>
  734. <div class="method-subsection discussion-section">
  735. <h4 class="method-subtitle">Discussion</h4>
  736. <p>Gets/Sets the maximum size of the buffer that will be allocated for receive operations.<br/>
  737. The default size is 9216 bytes.</p>
  738. <p>The theoretical maximum size of any IPv4 UDP packet is UINT16_MAX = 65535.<br/>
  739. The theoretical maximum size of any IPv6 UDP packet is UINT32_MAX = 4294967295.</p>
  740. <p>In practice, however, the size of UDP packets will be much smaller.<br/>
  741. Indeed most protocols will send and receive packets of only a few bytes,<br/>
  742. or will set a limit on the size of packets to prevent fragmentation in the IP layer.</p>
  743. <p>If you set the buffer size too small, the sockets API in the OS will silently discard<br/>
  744. any extra data, and you will not be notified of the error.</p>
  745. </div>
  746. <div class="method-subsection declared-in-section">
  747. <h4 class="method-subtitle">Declared In</h4>
  748. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  749. </div>
  750. </div>
  751. <div class="section-method">
  752. <a name="//api/name/maximumTransmissionUnit" title="maximumTransmissionUnit"></a>
  753. <h3 class="subsubtitle method-title">maximumTransmissionUnit</h3>
  754. <div class="method-subsection brief-description">
  755. <p>Returns the mtu of the socket.<br/>
  756. If unknown, returns zero.</p>
  757. </div>
  758. <div class="method-subsection method-declaration"><code>- (unsigned int)maximumTransmissionUnit</code></div>
  759. <div class="method-subsection discussion-section">
  760. <h4 class="method-subtitle">Discussion</h4>
  761. <p>Returns the mtu of the socket.<br/>
  762. If unknown, returns zero.</p>
  763. <p>Sending data larger than this may result in an error.<br/>
  764. This is an advanced topic, and one should understand the wide range of mtu&rsquo;s on networks and the internet.<br/>
  765. Therefore this method is only for reference and may be of little use in many situations.</p>
  766. </div>
  767. <div class="method-subsection declared-in-section">
  768. <h4 class="method-subtitle">Declared In</h4>
  769. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  770. </div>
  771. </div>
  772. <div class="section-method">
  773. <a name="//api/name/moveToRunLoop:" title="moveToRunLoop:"></a>
  774. <h3 class="subsubtitle method-title">moveToRunLoop:</h3>
  775. <div class="method-subsection brief-description">
  776. <p>When you create an AsyncUdpSocket, it is added to the runloop of the current thread.<br/>
  777. So it is easiest to simply create the socket on the thread you intend to use it.</p>
  778. </div>
  779. <div class="method-subsection method-declaration"><code>- (BOOL)moveToRunLoop:(NSRunLoop *)<em>runLoop</em></code></div>
  780. <div class="method-subsection discussion-section">
  781. <h4 class="method-subtitle">Discussion</h4>
  782. <p>When you create an AsyncUdpSocket, it is added to the runloop of the current thread.<br/>
  783. So it is easiest to simply create the socket on the thread you intend to use it.</p>
  784. <p>If, however, you need to move the socket to a separate thread at a later time, this<br/>
  785. method may be used to accomplish the task.</p>
  786. <p>This method must be called from the thread/runloop the socket is currently running on.</p>
  787. <p>Note: After calling this method, all further method calls to this object should be done from the given runloop.<br/>
  788. Also, all <a href="#//api/name/delegate">delegate</a> calls will be sent on the given runloop.</p>
  789. </div>
  790. <div class="method-subsection declared-in-section">
  791. <h4 class="method-subtitle">Declared In</h4>
  792. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  793. </div>
  794. </div>
  795. <div class="section-method">
  796. <a name="//api/name/receiveWithTimeout:tag:" title="receiveWithTimeout:tag:"></a>
  797. <h3 class="subsubtitle method-title">receiveWithTimeout:tag:</h3>
  798. <div class="method-subsection brief-description">
  799. <p>Asynchronously receives a single datagram packet.</p>
  800. </div>
  801. <div class="method-subsection method-declaration"><code>- (void)receiveWithTimeout:(NSTimeInterval)<em>timeout</em> tag:(long)<em>tag</em></code></div>
  802. <div class="method-subsection discussion-section">
  803. <h4 class="method-subtitle">Discussion</h4>
  804. <p>Asynchronously receives a single datagram packet.</p>
  805. <p>If the receive succeeds, the onUdpSocket:didReceiveData:fromHost:port:tag <a href="#//api/name/delegate">delegate</a> method will be called.<br/>
  806. Otherwise, a timeout will occur, and the onUdpSocket:didNotReceiveDataWithTag: <a href="#//api/name/delegate">delegate</a> method will be called.</p>
  807. </div>
  808. <div class="method-subsection declared-in-section">
  809. <h4 class="method-subtitle">Declared In</h4>
  810. <code class="declared-in-ref">AsyncUdpSocket.h</code><br />
  811. </div>
  812. </div>
  813. <div class="section-method">
  814. <a name="//api/name/runLoopModes" title="runLoopModes"></a>
  815. <h3 class="subsubtitle method-title">runLoopModes</h3>
  816. <div class="method-subsection brief-description">
  817. <p>Returns the current run loop modes the <a href="../Classes/AsyncSocket.html">AsyncSocket</a> instance is operating in.<br/>
  818. The default set of run loop modes is NSDefaultRunLoopMode.</p>
  819. </div>
  820. <div class="method-subsection method-declaration"><code>- (NSArray *)runLoopModes</code></div>

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