/Pods/Documentation/CocoaAsyncSocket/html/Classes/GCDAsyncUdpSocket.html
HTML | 3584 lines | 1901 code | 1683 blank | 0 comment | 0 complexity | b3aefa7ecd4161218937f5aed8e5c737 MD5 | raw file
Possible License(s): BSD-3-Clause
Large files files are truncated, but you can click here to view the full file
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="html/html; charset=utf-8" />
- <title>GCDAsyncUdpSocket Class Reference</title>
- <meta id="xcode-display" name="xcode-display" content="render"/>
- <link rel="stylesheet" type="text/css" href="../css/styles.css" media="all" />
- <link rel="stylesheet" type="text/css" media="print" href="../css/stylesPrint.css" />
- <meta name="generator" content="appledoc 2.1 (build 858)" />
- </head>
- <body>
- <header id="top_header">
- <div id="library" class="hideInXcode">
- <h1><a id="libraryTitle" href="../index.html">CocoaAsyncSocket 0.0.1 </a></h1>
- <a id="developerHome" href="../index.html">Dustin Voss and Robbie Hanson</a>
- </div>
-
- <div id="title" role="banner">
- <h1 class="hideInXcode">GCDAsyncUdpSocket Class Reference</h1>
- </div>
- <ul id="headerButtons" role="toolbar">
- <li id="toc_button">
- <button aria-label="Show Table of Contents" role="checkbox" class="open" id="table_of_contents"><span class="disclosure"></span>Table of Contents</button>
- </li>
- <li id="jumpto_button" role="navigation">
- <select id="jumpTo">
- <option value="top">Jump To…</option>
-
- <option value="overview">Overview</option>
-
-
-
-
- <option value="tasks">Tasks</option>
-
-
-
-
-
-
-
- <option value="class_methods">Class Methods</option>
-
- <option value="//api/name/familyFromAddress:"> + familyFromAddress:</option>
-
- <option value="//api/name/getHost:port:family:fromAddress:"> + getHost:port:family:fromAddress:</option>
-
- <option value="//api/name/getHost:port:fromAddress:"> + getHost:port:fromAddress:</option>
-
- <option value="//api/name/hostFromAddress:"> + hostFromAddress:</option>
-
- <option value="//api/name/isIPv4Address:"> + isIPv4Address:</option>
-
- <option value="//api/name/isIPv6Address:"> + isIPv6Address:</option>
-
- <option value="//api/name/portFromAddress:"> + portFromAddress:</option>
-
-
-
-
- <option value="instance_methods">Instance Methods</option>
-
- <option value="//api/name/beginReceiving:"> - beginReceiving:</option>
-
- <option value="//api/name/bindToAddress:error:"> - bindToAddress:error:</option>
-
- <option value="//api/name/bindToPort:error:"> - bindToPort:error:</option>
-
- <option value="//api/name/bindToPort:interface:error:"> - bindToPort:interface:error:</option>
-
- <option value="//api/name/close"> - close</option>
-
- <option value="//api/name/closeAfterSending"> - closeAfterSending</option>
-
- <option value="//api/name/connectToAddress:error:"> - connectToAddress:error:</option>
-
- <option value="//api/name/connectToHost:onPort:error:"> - connectToHost:onPort:error:</option>
-
- <option value="//api/name/connectedAddress"> - connectedAddress</option>
-
- <option value="//api/name/connectedHost"> - connectedHost</option>
-
- <option value="//api/name/connectedPort"> - connectedPort</option>
-
- <option value="//api/name/delegate"> - delegate</option>
-
- <option value="//api/name/delegateQueue"> - delegateQueue</option>
-
- <option value="//api/name/enableBroadcast:error:"> - enableBroadcast:error:</option>
-
- <option value="//api/name/getDelegate:delegateQueue:"> - getDelegate:delegateQueue:</option>
-
- <option value="//api/name/init"> - init</option>
-
- <option value="//api/name/initWithDelegate:delegateQueue:"> - initWithDelegate:delegateQueue:</option>
-
- <option value="//api/name/initWithDelegate:delegateQueue:socketQueue:"> - initWithDelegate:delegateQueue:socketQueue:</option>
-
- <option value="//api/name/initWithSocketQueue:"> - initWithSocketQueue:</option>
-
- <option value="//api/name/isClosed"> - isClosed</option>
-
- <option value="//api/name/isConnected"> - isConnected</option>
-
- <option value="//api/name/isIPVersionNeutral"> - isIPVersionNeutral</option>
-
- <option value="//api/name/isIPv4"> - isIPv4</option>
-
- <option value="//api/name/isIPv4Enabled"> - isIPv4Enabled</option>
-
- <option value="//api/name/isIPv4Preferred"> - isIPv4Preferred</option>
-
- <option value="//api/name/isIPv6"> - isIPv6</option>
-
- <option value="//api/name/isIPv6Enabled"> - isIPv6Enabled</option>
-
- <option value="//api/name/isIPv6Preferred"> - isIPv6Preferred</option>
-
- <option value="//api/name/joinMulticastGroup:error:"> - joinMulticastGroup:error:</option>
-
- <option value="//api/name/joinMulticastGroup:onInterface:error:"> - joinMulticastGroup:onInterface:error:</option>
-
- <option value="//api/name/leaveMulticastGroup:error:"> - leaveMulticastGroup:error:</option>
-
- <option value="//api/name/leaveMulticastGroup:onInterface:error:"> - leaveMulticastGroup:onInterface:error:</option>
-
- <option value="//api/name/localAddress"> - localAddress</option>
-
- <option value="//api/name/localAddress_IPv4"> - localAddress_IPv4</option>
-
- <option value="//api/name/localAddress_IPv6"> - localAddress_IPv6</option>
-
- <option value="//api/name/localHost"> - localHost</option>
-
- <option value="//api/name/localHost_IPv4"> - localHost_IPv4</option>
-
- <option value="//api/name/localHost_IPv6"> - localHost_IPv6</option>
-
- <option value="//api/name/localPort"> - localPort</option>
-
- <option value="//api/name/localPort_IPv4"> - localPort_IPv4</option>
-
- <option value="//api/name/localPort_IPv6"> - localPort_IPv6</option>
-
- <option value="//api/name/maxReceiveIPv4BufferSize"> - maxReceiveIPv4BufferSize</option>
-
- <option value="//api/name/maxReceiveIPv6BufferSize"> - maxReceiveIPv6BufferSize</option>
-
- <option value="//api/name/pauseReceiving"> - pauseReceiving</option>
-
- <option value="//api/name/performBlock:"> - performBlock:</option>
-
- <option value="//api/name/readStream"> - readStream</option>
-
- <option value="//api/name/receiveOnce:"> - receiveOnce:</option>
-
- <option value="//api/name/sendData:toAddress:withTimeout:tag:"> - sendData:toAddress:withTimeout:tag:</option>
-
- <option value="//api/name/sendData:toHost:port:withTimeout:tag:"> - sendData:toHost:port:withTimeout:tag:</option>
-
- <option value="//api/name/sendData:withTimeout:tag:"> - sendData:withTimeout:tag:</option>
-
- <option value="//api/name/setDelegate:"> - setDelegate:</option>
-
- <option value="//api/name/setDelegate:delegateQueue:"> - setDelegate:delegateQueue:</option>
-
- <option value="//api/name/setDelegateQueue:"> - setDelegateQueue:</option>
-
- <option value="//api/name/setIPVersionNeutral"> - setIPVersionNeutral</option>
-
- <option value="//api/name/setIPv4Enabled:"> - setIPv4Enabled:</option>
-
- <option value="//api/name/setIPv6Enabled:"> - setIPv6Enabled:</option>
-
- <option value="//api/name/setMaxReceiveIPv4BufferSize:"> - setMaxReceiveIPv4BufferSize:</option>
-
- <option value="//api/name/setMaxReceiveIPv6BufferSize:"> - setMaxReceiveIPv6BufferSize:</option>
-
- <option value="//api/name/setPreferIPv4"> - setPreferIPv4</option>
-
- <option value="//api/name/setPreferIPv6"> - setPreferIPv6</option>
-
- <option value="//api/name/setReceiveFilter:withQueue:"> - setReceiveFilter:withQueue:</option>
-
- <option value="//api/name/setReceiveFilter:withQueue:isAsynchronous:"> - setReceiveFilter:withQueue:isAsynchronous:</option>
-
- <option value="//api/name/setSendFilter:withQueue:"> - setSendFilter:withQueue:</option>
-
- <option value="//api/name/setSendFilter:withQueue:isAsynchronous:"> - setSendFilter:withQueue:isAsynchronous:</option>
-
- <option value="//api/name/setUserData:"> - setUserData:</option>
-
- <option value="//api/name/socket4FD"> - socket4FD</option>
-
- <option value="//api/name/socket6FD"> - socket6FD</option>
-
- <option value="//api/name/socketFD"> - socketFD</option>
-
- <option value="//api/name/synchronouslySetDelegate:"> - synchronouslySetDelegate:</option>
-
- <option value="//api/name/synchronouslySetDelegate:delegateQueue:"> - synchronouslySetDelegate:delegateQueue:</option>
-
- <option value="//api/name/synchronouslySetDelegateQueue:"> - synchronouslySetDelegateQueue:</option>
-
- <option value="//api/name/userData"> - userData</option>
-
- <option value="//api/name/writeStream"> - writeStream</option>
-
-
-
- </select>
- </li>
- </ul>
- </header>
- <nav id="tocContainer" class="isShowingTOC">
- <ul id="toc" role="tree">
-
- <li role="treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#overview">Overview</a></span></li>
- <li role="treeitem" id="task_treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#tasks">Tasks</a></span><ul>
-
- </ul></li>
- <li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#class_methods">Class Methods</a></span><ul>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/familyFromAddress:">familyFromAddress:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/getHost:port:family:fromAddress:">getHost:port:family:fromAddress:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/getHost:port:fromAddress:">getHost:port:fromAddress:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/hostFromAddress:">hostFromAddress:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isIPv4Address:">isIPv4Address:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isIPv6Address:">isIPv6Address:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/portFromAddress:">portFromAddress:</a></span></li>
-
- </ul></li>
- <li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#instance_methods">Instance Methods</a></span><ul>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/beginReceiving:">beginReceiving:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/bindToAddress:error:">bindToAddress:error:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/bindToPort:error:">bindToPort:error:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/bindToPort:interface:error:">bindToPort:interface:error:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/close">close</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/closeAfterSending">closeAfterSending</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectToAddress:error:">connectToAddress:error:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectToHost:onPort:error:">connectToHost:onPort:error:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectedAddress">connectedAddress</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectedHost">connectedHost</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectedPort">connectedPort</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/delegate">delegate</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/delegateQueue">delegateQueue</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/enableBroadcast:error:">enableBroadcast:error:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/getDelegate:delegateQueue:">getDelegate:delegateQueue:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/init">init</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/initWithDelegate:delegateQueue:">initWithDelegate:delegateQueue:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/initWithDelegate:delegateQueue:socketQueue:">initWithDelegate:delegateQueue:socketQueue:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/initWithSocketQueue:">initWithSocketQueue:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isClosed">isClosed</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isConnected">isConnected</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isIPVersionNeutral">isIPVersionNeutral</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isIPv4">isIPv4</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isIPv4Enabled">isIPv4Enabled</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isIPv4Preferred">isIPv4Preferred</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isIPv6">isIPv6</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isIPv6Enabled">isIPv6Enabled</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isIPv6Preferred">isIPv6Preferred</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/joinMulticastGroup:error:">joinMulticastGroup:error:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/joinMulticastGroup:onInterface:error:">joinMulticastGroup:onInterface:error:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/leaveMulticastGroup:error:">leaveMulticastGroup:error:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/leaveMulticastGroup:onInterface:error:">leaveMulticastGroup:onInterface:error:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/localAddress">localAddress</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/localAddress_IPv4">localAddress_IPv4</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/localAddress_IPv6">localAddress_IPv6</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/localHost">localHost</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/localHost_IPv4">localHost_IPv4</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/localHost_IPv6">localHost_IPv6</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/localPort">localPort</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/localPort_IPv4">localPort_IPv4</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/localPort_IPv6">localPort_IPv6</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/maxReceiveIPv4BufferSize">maxReceiveIPv4BufferSize</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/maxReceiveIPv6BufferSize">maxReceiveIPv6BufferSize</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/pauseReceiving">pauseReceiving</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/performBlock:">performBlock:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/readStream">readStream</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/receiveOnce:">receiveOnce:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/sendData:toAddress:withTimeout:tag:">sendData:toAddress:withTimeout:tag:</a></span></li>
-
- <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>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/sendData:withTimeout:tag:">sendData:withTimeout:tag:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setDelegate:">setDelegate:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setDelegate:delegateQueue:">setDelegate:delegateQueue:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setDelegateQueue:">setDelegateQueue:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setIPVersionNeutral">setIPVersionNeutral</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setIPv4Enabled:">setIPv4Enabled:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setIPv6Enabled:">setIPv6Enabled:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setMaxReceiveIPv4BufferSize:">setMaxReceiveIPv4BufferSize:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setMaxReceiveIPv6BufferSize:">setMaxReceiveIPv6BufferSize:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setPreferIPv4">setPreferIPv4</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setPreferIPv6">setPreferIPv6</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setReceiveFilter:withQueue:">setReceiveFilter:withQueue:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setReceiveFilter:withQueue:isAsynchronous:">setReceiveFilter:withQueue:isAsynchronous:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setSendFilter:withQueue:">setSendFilter:withQueue:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setSendFilter:withQueue:isAsynchronous:">setSendFilter:withQueue:isAsynchronous:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setUserData:">setUserData:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/socket4FD">socket4FD</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/socket6FD">socket6FD</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/socketFD">socketFD</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/synchronouslySetDelegate:">synchronouslySetDelegate:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/synchronouslySetDelegate:delegateQueue:">synchronouslySetDelegate:delegateQueue:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/synchronouslySetDelegateQueue:">synchronouslySetDelegateQueue:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/userData">userData</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/writeStream">writeStream</a></span></li>
-
- </ul></li>
- </ul>
- </nav>
- <article>
- <div id="contents" class="isShowingTOC" role="main">
- <a title="GCDAsyncUdpSocket Class Reference" name="top"></a>
- <div class="main-navigation navigation-top">
- <ul>
- <li><a href="../index.html">Index</a></li>
- <li><a href="../hierarchy.html">Hierarchy</a></li>
- </ul>
- </div>
- <div id="header">
- <div class="section-header">
- <h1 class="title title-header">GCDAsyncUdpSocket Class Reference</h1>
- </div>
- </div>
- <div id="container">
-
- <div class="section section-specification"><table cellspacing="0"><tbody>
- <tr>
- <td class="specification-title">Inherits from</td>
- <td class="specification-value">NSObject</td>
- </tr><tr>
- <td class="specification-title">Declared in</td>
- <td class="specification-value">GCDAsyncUdpSocket.h</td>
- </tr>
- </tbody></table></div>
-
-
-
-
- <div class="section section-overview">
- <a title="Overview" name="overview"></a>
- <h2 class="subtitle subtitle-overview">Overview</h2>
- <p>You may optionally set a send filter for the socket.<br/>
- A filter can provide several interesting possibilities:</p>
- <ol>
- <li><p>Optional caching of resolved addresses for domain names.<br/>
- The cache could later be consulted, resulting in fewer system calls to getaddrinfo.</p></li>
- <li><p>Reusable modules of code for bandwidth monitoring.</p></li>
- <li><p>Sometimes traffic shapers are needed to simulate real world environments.<br/>
- A filter allows you to write custom code to simulate such environments.<br/>
- The ability to code this yourself is especially helpful when your simulated environment<br/>
- is more complicated than simple traffic shaping (e.g. simulating a cone port restricted router),<br/>
- or the system tools to handle this aren’t available (e.g. on a mobile device).</p></li>
- </ol>
- </div>
-
-
-
-
-
- <div class="section section-tasks">
- <a title="Tasks" name="tasks"></a>
- <h2 class="subtitle subtitle-tasks">Tasks</h2>
-
-
-
-
- <ul class="task-list">
- <li>
- <span class="tooltip">
- <code><a href="#//api/name/init">– init</a></code>
- <span class="tooltip"><p>GCD<a href="../Classes/AsyncUdpSocket.html">AsyncUdpSocket</a> uses the standard <a href="#//api/name/delegate">delegate</a> paradigm,<br/>
- but executes all <a href="#//api/name/delegate">delegate</a> callbacks on a given <a href="#//api/name/delegate">delegate</a> dispatch queue.<br/>
- This allows for maximum concurrency, while at the same time providing easy thread safety.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/initWithSocketQueue:">– initWithSocketQueue:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/initWithDelegate:delegateQueue:">– initWithDelegate:delegateQueue:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/initWithDelegate:delegateQueue:socketQueue:">– initWithDelegate:delegateQueue:socketQueue:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/delegate">– delegate</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/setDelegate:">– setDelegate:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/synchronouslySetDelegate:">– synchronouslySetDelegate:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/delegateQueue">– delegateQueue</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/setDelegateQueue:">– setDelegateQueue:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/synchronouslySetDelegateQueue:">– synchronouslySetDelegateQueue:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/getDelegate:delegateQueue:">– getDelegate:delegateQueue:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/setDelegate:delegateQueue:">– setDelegate:delegateQueue:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/synchronouslySetDelegate:delegateQueue:">– synchronouslySetDelegate:delegateQueue:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/isIPv4Enabled">– isIPv4Enabled</a></code>
- <span class="tooltip"><p>By default, both IPv4 and IPv6 are enabled.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/setIPv4Enabled:">– setIPv4Enabled:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/isIPv6Enabled">– isIPv6Enabled</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/setIPv6Enabled:">– setIPv6Enabled:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/isIPv4Preferred">– isIPv4Preferred</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/isIPv6Preferred">– isIPv6Preferred</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/isIPVersionNeutral">– isIPVersionNeutral</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/setPreferIPv4">– setPreferIPv4</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/setPreferIPv6">– setPreferIPv6</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/setIPVersionNeutral">– setIPVersionNeutral</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/maxReceiveIPv4BufferSize">– maxReceiveIPv4BufferSize</a></code>
- <span class="tooltip"><p>Gets/Sets the maximum size of the buffer that will be allocated for receive operations.<br/>
- The default maximum size is 9216 bytes.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/setMaxReceiveIPv4BufferSize:">– setMaxReceiveIPv4BufferSize:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/maxReceiveIPv6BufferSize">– maxReceiveIPv6BufferSize</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/setMaxReceiveIPv6BufferSize:">– setMaxReceiveIPv6BufferSize:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/userData">– userData</a></code>
- <span class="tooltip"><p>User data allows you to associate arbitrary information with the socket.<br/>
- This data is not used internally in any way.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/setUserData:">– setUserData:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/localAddress">– localAddress</a></code>
- <span class="tooltip"><p>Returns the local address info for the socket.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/localHost">– localHost</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/localPort">– localPort</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/localAddress_IPv4">– localAddress_IPv4</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/localHost_IPv4">– localHost_IPv4</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/localPort_IPv4">– localPort_IPv4</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/localAddress_IPv6">– localAddress_IPv6</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/localHost_IPv6">– localHost_IPv6</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/localPort_IPv6">– localPort_IPv6</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/connectedAddress">– connectedAddress</a></code>
- <span class="tooltip"><p>Returns the remote address info for the socket.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/connectedHost">– connectedHost</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/connectedPort">– connectedPort</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/isConnected">– isConnected</a></code>
- <span class="tooltip"><p>Returns whether or not this socket has been connected to a single host.<br/>
- By design, UDP is a connectionless protocol, and connecting is not needed.<br/>
- If connected, the socket will only be able to send/receive data to/from the connected host.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/isClosed">– isClosed</a></code>
- <span class="tooltip"><p>Returns whether or not this socket has been closed.<br/>
- 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>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/isIPv4">– isIPv4</a></code>
- <span class="tooltip"><p>Returns whether or not this socket is IPv4.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/isIPv6">– isIPv6</a></code>
- <span class="tooltip"><p>Returns whether or not this socket is IPv6.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/bindToPort:error:">– bindToPort:error:</a></code>
- <span class="tooltip"><p>Binds the UDP socket to the given port.<br/>
- Binding should be done for server sockets that receive data prior to sending it.<br/>
- Client sockets can skip binding,<br/>
- as the OS will automatically assign the socket an available port when it starts sending data.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/bindToPort:interface:error:">– bindToPort:interface:error:</a></code>
- <span class="tooltip"><p>Binds the UDP socket to the given port and optional interface.<br/>
- Binding should be done for server sockets that receive data prior to sending it.<br/>
- Client sockets can skip binding,<br/>
- as the OS will automatically assign the socket an available port when it starts sending data.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/bindToAddress:error:">– bindToAddress:error:</a></code>
- <span class="tooltip"><p>Binds the UDP socket to the given address, specified as a sockaddr structure wrapped in a NSData object.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/connectToHost:onPort:error:">– connectToHost:onPort:error:</a></code>
- <span class="tooltip"><p>Connects the UDP socket to the given host and port.<br/>
- By design, UDP is a connectionless protocol, and connecting is not needed.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/connectToAddress:error:">– connectToAddress:error:</a></code>
- <span class="tooltip"><p>Connects the UDP socket to the given address, specified as a sockaddr structure wrapped in a NSData object.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/joinMulticastGroup:error:">– joinMulticastGroup:error:</a></code>
- <span class="tooltip"><p>Join multicast group.<br/>
- Group should be an IP address (eg @“225.228.0.1”).</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/joinMulticastGroup:onInterface:error:">– joinMulticastGroup:onInterface:error:</a></code>
- <span class="tooltip"><p>Join multicast group.<br/>
- Group should be an IP address (eg @“225.228.0.1”).<br/>
- The interface may be a name (e.g. “en1” or “lo0”) or the corresponding IP address (e.g. “192.168.4.35”).</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/leaveMulticastGroup:error:">– leaveMulticastGroup:error:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/leaveMulticastGroup:onInterface:error:">– leaveMulticastGroup:onInterface:error:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/enableBroadcast:error:">– enableBroadcast:error:</a></code>
- <span class="tooltip"><p>By default, the underlying socket in the OS will not allow you to send broadcast messages.<br/>
- In order to send broadcast messages, you need to enable this functionality in the socket.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/sendData:withTimeout:tag:">– sendData:withTimeout:tag:</a></code>
- <span class="tooltip"><p>Asynchronously sends the given data, with the given timeout and tag.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/sendData:toHost:port:withTimeout:tag:">– sendData:toHost:port:withTimeout:tag:</a></code>
- <span class="tooltip"><p>Asynchronously sends the given data, with the given timeout and tag, to the given host and port.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/sendData:toAddress:withTimeout:tag:">– sendData:toAddress:withTimeout:tag:</a></code>
- <span class="tooltip"><p>Asynchronously sends the given data, with the given timeout and tag, to the given address.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/setSendFilter:withQueue:">– setSendFilter:withQueue:</a></code>
- <span class="tooltip"><p>You may optionally set a send filter for the socket.<br/>
- A filter can provide several interesting possibilities:</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/setSendFilter:withQueue:isAsynchronous:">– setSendFilter:withQueue:isAsynchronous:</a></code>
- <span class="tooltip"><p>The receive filter can be run via dispatch_async or dispatch_sync.<br/>
- Most typical situations call for asynchronous operation.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/receiveOnce:">– receiveOnce:</a></code>
- <span class="tooltip"><p>There are two modes of operation for receiving packets: one-at-a-time & continuous.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/beginReceiving:">– beginReceiving:</a></code>
- <span class="tooltip"><p>There are two modes of operation for receiving packets: one-at-a-time & continuous.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/pauseReceiving">– pauseReceiving</a></code>
- <span class="tooltip"><p>If the socket is currently receiving (beginReceiving has been called), this method pauses the receiving.<br/>
- That is, it won’t read any more packets from the underlying OS socket until beginReceiving is called again.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/setReceiveFilter:withQueue:">– setReceiveFilter:withQueue:</a></code>
- <span class="tooltip"><p>You may optionally set a receive filter for the socket.<br/>
- This receive filter may be set to run in its own queue (independent of <a href="#//api/name/delegate">delegate</a> queue).</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/setReceiveFilter:withQueue:isAsynchronous:">– setReceiveFilter:withQueue:isAsynchronous:</a></code>
- <span class="tooltip"><p>The receive filter can be run via dispatch_async or dispatch_sync.<br/>
- Most typical situations call for asynchronous operation.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/close">– close</a></code>
- <span class="tooltip"><p>Immediately closes the underlying socket.<br/>
- Any pending send operations are discarded.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/closeAfterSending">– closeAfterSending</a></code>
- <span class="tooltip"><p>Closes the underlying socket after all pending send operations have been sent.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/performBlock:">– performBlock:</a></code>
- <span class="tooltip"><p>It’s not thread-safe to access certain variables from outside the socket’s internal queue.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/socketFD">– socketFD</a></code>
- <span class="tooltip"><p>These methods are only available from within the context of a <a href="#//api/name/performBlock:">performBlock:</a> invocation.<br/>
- See the documentation for the <a href="#//api/name/performBlock:">performBlock:</a> method above.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/socket4FD">– socket4FD</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/socket6FD">– socket6FD</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/readStream">– readStream</a></code>
- <span class="tooltip"><p>These methods are only available from within the context of a <a href="#//api/name/performBlock:">performBlock:</a> invocation.<br/>
- See the documentation for the <a href="#//api/name/performBlock:">performBlock:</a> method above.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/writeStream">– writeStream</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/hostFromAddress:">+ hostFromAddress:</a></code>
- <span class="tooltip"><p>Extracting host/port/family information from raw address data.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/portFromAddress:">+ portFromAddress:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/familyFromAddress:">+ familyFromAddress:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/isIPv4Address:">+ isIPv4Address:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/isIPv6Address:">+ isIPv6Address:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/getHost:port:fromAddress:">+ getHost:port:fromAddress:</a></code>
-
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/getHost:port:family:fromAddress:">+ getHost:port:family:fromAddress:</a></code>
-
- </span>
-
-
- </li>
- </ul>
-
- </div>
-
-
-
-
-
-
-
- <div class="section section-methods">
- <a title="Class Methods" name="class_methods"></a>
- <h2 class="subtitle subtitle-methods">Class Methods</h2>
-
- <div class="section-method">
- <a name="//api/name/familyFromAddress:" title="familyFromAddress:"></a>
- <h3 class="subsubtitle method-title">familyFromAddress:</h3>
-
-
- <div class="method-subsection method-declaration"><code>+ (int)familyFromAddress:(NSData *)<em>address</em></code></div>
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/getHost:port:family:fromAddress:" title="getHost:port:family:fromAddress:"></a>
- <h3 class="subsubtitle method-title">getHost:port:family:fromAddress:</h3>
-
-
- <div class="method-subsection method-declaration"><code>+ (BOOL)getHost:(NSString **)<em>hostPtr</em> port:(uint16_t *)<em>portPtr</em> family:(int *)<em>afPtr</em> fromAddress:(NSData *)<em>address</em></code></div>
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/getHost:port:fromAddress:" title="getHost:port:fromAddress:"></a>
- <h3 class="subsubtitle method-title">getHost:port:fromAddress:</h3>
-
-
- <div class="method-subsection method-declaration"><code>+ (BOOL)getHost:(NSString **)<em>hostPtr</em> port:(uint16_t *)<em>portPtr</em> fromAddress:(NSData *)<em>address</em></code></div>
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/hostFromAddress:" title="hostFromAddress:"></a>
- <h3 class="subsubtitle method-title">hostFromAddress:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>Extracting host/port/family information from raw address data.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>+ (NSString *)hostFromAddress:(NSData *)<em>address</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>Extracting host/port/family information from raw address data.</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">GCDAsyncUdpSocket.h</code><br />
- </div>
-
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/isIPv4Address:" title="isIPv4Address:"></a>
- <h3 class="subsubtitle method-title">isIPv4Address:</h3>
-
-
- <div class="method-subsection method-declaration"><code>+ (BOOL)isIPv4Address:(NSData *)<em>address</em></code></div>
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/isIPv6Address:" title="isIPv6Address:"></a>
- <h3 class="subsubtitle method-title">isIPv6Address:</h3>
-
-
- <div class="method-subsection method-declaration"><code>+ (BOOL)isIPv6Address:(NSData *)<em>address</em></code></div>
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/portFromAddress:" title="portFromAddress:"></a>
- <h3 class="subsubtitle method-title">portFromAddress:</h3>
-
-
- <div class="method-subsection method-declaration"><code>+ (uint16_t)portFromAddress:(NSData *)<em>address</em></code></div>
-
- </div>
-
- </div>
-
-
-
- <div class="section section-methods">
- <a title="Instance Methods" name="instance_methods"></a>
- <h2 class="subtitle subtitle-methods">Instance Methods</h2>
-
- <div class="section-method">
- <a name="//api/name/beginReceiving:" title="beginReceiving:"></a>
- <h3 class="subsubtitle method-title">beginReceiving:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>There are two modes of operation for receiving packets: one-at-a-time & continuous.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (BOOL)beginReceiving:(NSError **)<em>errPtr</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>There are two modes of operation for receiving packets: one-at-a-time & continuous.</p>
- <p>In one-at-a-time mode, you call receiveOnce everytime your <a href="#//api/name/delegate">delegate</a> is ready to process an incoming udp packet.<br/>
- Receiving packets one-at-a-time may be better suited for implementing certain state machine code,<br/>
- where your state machine may not always be ready to process incoming packets.</p>
- <p>In continuous mode, the <a href="#//api/name/delegate">delegate</a> is invoked immediately everytime incoming udp packets are received.<br/>
- Receiving packets continuously is better suited to real-time streaming applications.</p>
- <p>You may switch back and forth between one-at-a-time mode and continuous mode.<br/>
- If the socket is currently in one-at-a-time mode, calling this method will switch it to continuous mode.</p>
- <p>For every received packet (not filtered by the optional receive filter),<br/>
- the <a href="#//api/name/delegate">delegate</a> method (udpSocket:didReceiveData:fromAddress:withFilterContext:) is invoked.</p>
- <p>If the socket is able to begin receiving packets, this method returns YES.<br/>
- Otherwise it returns NO, and sets the errPtr with appropriate error information.</p>
- <p>An example error:<br/>
- You created a udp socket to act as a server, and immediately called receive.<br/>
- You forgot to first bind the socket to a port number, and received a error with a message like:<br/>
- “Must bind socket before you can receive data.”</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">GCDAsyncUdpSocket.h</code><br />
- </div>
-
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/bindToAddress:error:" title="bindToAddress:error:"></a>
- <h3 class="subsubtitle method-title">bindToAddress:error:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>Binds the UDP socket to the given address, specified as a sockaddr structure wrapped in a NSData object.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (BOOL)bindToAddress:(NSData *)<em>localAddr</em> error:(NSError **)<em>errPtr</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>Binds the UDP socket to the given address, specified as a sockaddr structure wrapped in a NSData object.</p>
- <p>If you have an existing struct sockaddr you can convert it to a NSData object like so:<br/>
- struct sockaddr sa -> NSData <em>dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len];<br/>
- struct sockaddr </em>sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len];</p>
- <p>Binding should be done for server sockets that receive data prior to sending it.<br/>
- Client sockets can skip binding,<br/>
- as the OS will automatically assign the socket an available port when it starts sending data.</p>
- <p>You cannot bind a socket after its been connected.<br/>
- You can only bind a socket once.<br/>
- You can still connect a socket (if desired) after binding.</p>
- <p>On success, returns YES.<br/>
- Otherwise returns NO, and sets errPtr. If you don’t care about the error, you can pass NULL for errPtr.</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">GCDAsyncUdpSocket.h</code><br />
- </div>
-
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/bindToPort:error:" title="bindToPort:error:"></a>
- <h3 class="subsubtitle method-title">bindToPort:error:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>Binds the UDP socket to the given port.<br/>
- Binding should be done for server sockets that receive data prior to sending it.<br/>
- Client sockets can skip binding,<br/>
- as the OS will automatically assign the socket an available port when it starts sending data.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (BOOL)bindToPort:(uint16_t)<em>port</em> error:(NSError **)<em>errPtr</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>Binds the UDP socket to the given port.<br/>
- Binding should be done for server sockets that receive data prior to sending it.<br/>
- Client socke…
Large files files are truncated, but you can click here to view the full file