/Pods/Documentation/CocoaAsyncSocket/docset/Contents/Resources/Documents/Protocols/AsyncSocketDelegate.html
HTML | 998 lines | 536 code | 462 blank | 0 comment | 0 complexity | 9066c9d118ef1a50657871aea42c6e39 MD5 | raw file
Possible License(s): BSD-3-Clause
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="html/html; charset=utf-8" />
- <title>AsyncSocketDelegate Protocol 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">AsyncSocketDelegate Protocol 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="tasks">Tasks</option>
-
-
-
-
-
-
-
-
-
- <option value="instance_methods">Instance Methods</option>
-
- <option value="//api/name/onSocket:didAcceptNewSocket:"> - onSocket:didAcceptNewSocket:</option>
-
- <option value="//api/name/onSocket:didConnectToHost:port:"> - onSocket:didConnectToHost:port:</option>
-
- <option value="//api/name/onSocket:didReadData:withTag:"> - onSocket:didReadData:withTag:</option>
-
- <option value="//api/name/onSocket:didReadPartialDataOfLength:tag:"> - onSocket:didReadPartialDataOfLength:tag:</option>
-
- <option value="//api/name/onSocket:didWriteDataWithTag:"> - onSocket:didWriteDataWithTag:</option>
-
- <option value="//api/name/onSocket:didWritePartialDataOfLength:tag:"> - onSocket:didWritePartialDataOfLength:tag:</option>
-
- <option value="//api/name/onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:"> - onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:</option>
-
- <option value="//api/name/onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:"> - onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:</option>
-
- <option value="//api/name/onSocket:wantsRunLoopForNewSocket:"> - onSocket:wantsRunLoopForNewSocket:</option>
-
- <option value="//api/name/onSocket:willDisconnectWithError:"> - onSocket:willDisconnectWithError:</option>
-
- <option value="//api/name/onSocketDidDisconnect:"> - onSocketDidDisconnect:</option>
-
- <option value="//api/name/onSocketDidSecure:"> - onSocketDidSecure:</option>
-
- <option value="//api/name/onSocketWillConnect:"> - onSocketWillConnect:</option>
-
-
-
- </select>
- </li>
- </ul>
- </header>
- <nav id="tocContainer" class="isShowingTOC">
- <ul id="toc" role="tree">
-
- <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="#instance_methods">Instance Methods</a></span><ul>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:didAcceptNewSocket:">onSocket:didAcceptNewSocket:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:didConnectToHost:port:">onSocket:didConnectToHost:port:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:didReadData:withTag:">onSocket:didReadData:withTag:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:didReadPartialDataOfLength:tag:">onSocket:didReadPartialDataOfLength:tag:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:didWriteDataWithTag:">onSocket:didWriteDataWithTag:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:didWritePartialDataOfLength:tag:">onSocket:didWritePartialDataOfLength:tag:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:">onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:">onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:wantsRunLoopForNewSocket:">onSocket:wantsRunLoopForNewSocket:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocket:willDisconnectWithError:">onSocket:willDisconnectWithError:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocketDidDisconnect:">onSocketDidDisconnect:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocketDidSecure:">onSocketDidSecure:</a></span></li>
-
- <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/onSocketWillConnect:">onSocketWillConnect:</a></span></li>
-
- </ul></li>
- </ul>
- </nav>
- <article>
- <div id="contents" class="isShowingTOC" role="main">
- <a title="AsyncSocketDelegate Protocol 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">AsyncSocketDelegate Protocol Reference</h1>
- </div>
- </div>
- <div id="container">
-
- <div class="section section-specification"><table cellspacing="0"><tbody>
- <tr>
- <td class="specification-title">Declared in</td>
- <td class="specification-value">AsyncSocket.h</td>
- </tr>
- </tbody></table></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/onSocket:willDisconnectWithError:">– onSocket:willDisconnectWithError:</a></code>
- <span class="tooltip"><p>In the event of an error, the socket is closed.<br/>
- You may call “unreadData” during this call-back to get the last bit of data off the socket.<br/>
- When connecting, this delegate method may be called<br/>
- before"onSocket:didAcceptNewSocket:“ or "onSocket:didConnectToHost:”.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/onSocketDidDisconnect:">– onSocketDidDisconnect:</a></code>
- <span class="tooltip"><p>Called when a socket disconnects with or without error. If you want to release a socket after it disconnects,<br/>
- do so here. It is not safe to do that during “onSocket:willDisconnectWithError:”.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/onSocket:didAcceptNewSocket:">– onSocket:didAcceptNewSocket:</a></code>
- <span class="tooltip"><p>Called when a socket accepts a connection. Another socket is spawned to handle it. The new socket will have<br/>
- the same delegate and will call “onSocket:didConnectToHost:port:”.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/onSocket:wantsRunLoopForNewSocket:">– onSocket:wantsRunLoopForNewSocket:</a></code>
- <span class="tooltip"><p>Called when a new socket is spawned to handle a connection. This method should return the run-loop of the<br/>
- thread on which the new socket and its delegate should operate. If omitted, [NSRunLoop currentRunLoop] is used.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/onSocketWillConnect:">– onSocketWillConnect:</a></code>
- <span class="tooltip"><p>Called when a socket is about to connect. This method should return YES to continue, or NO to abort.<br/>
- If aborted, will result in AsyncSocketCanceledError.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/onSocket:didConnectToHost:port:">– onSocket:didConnectToHost:port:</a></code>
- <span class="tooltip"><p>Called when a socket connects and is ready for reading and writing.<br/>
- The host parameter will be an IP address, not a DNS name.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/onSocket:didReadData:withTag:">– onSocket:didReadData:withTag:</a></code>
- <span class="tooltip"><p>Called when a socket has completed reading the requested data into memory.<br/>
- Not called if there is an error.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/onSocket:didReadPartialDataOfLength:tag:">– onSocket:didReadPartialDataOfLength:tag:</a></code>
- <span class="tooltip"><p>Called when a socket has read in data, but has not yet completed the read.<br/>
- This would occur if using readToData: or readToLength: methods.<br/>
- It may be used to for things such as updating progress bars.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/onSocket:didWriteDataWithTag:">– onSocket:didWriteDataWithTag:</a></code>
- <span class="tooltip"><p>Called when a socket has completed writing the requested data. Not called if there is an error.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/onSocket:didWritePartialDataOfLength:tag:">– onSocket:didWritePartialDataOfLength:tag:</a></code>
- <span class="tooltip"><p>Called when a socket has written some data, but has not yet completed the entire write.<br/>
- It may be used to for things such as updating progress bars.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:">– onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:</a></code>
- <span class="tooltip"><p>Called if a read operation has reached its timeout without completing.<br/>
- This method allows you to optionally extend the timeout.<br/>
- If you return a positive time interval (> 0) the read’s timeout will be extended by the given amount.<br/>
- If you don’t implement this method, or return a non-positive time interval (<= 0) the read will timeout as usual.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:">– onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:</a></code>
- <span class="tooltip"><p>Called if a write operation has reached its timeout without completing.<br/>
- This method allows you to optionally extend the timeout.<br/>
- If you return a positive time interval (> 0) the write’s timeout will be extended by the given amount.<br/>
- If you don’t implement this method, or return a non-positive time interval (<= 0) the write will timeout as usual.</p></span>
- </span>
-
-
- </li><li>
- <span class="tooltip">
- <code><a href="#//api/name/onSocketDidSecure:">– onSocketDidSecure:</a></code>
- <span class="tooltip"><p>Called after the socket has successfully completed SSL/TLS negotiation.<br/>
- This method is not called unless you use the provided startTLS method.</p></span>
- </span>
-
-
- </li>
- </ul>
-
- </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/onSocket:didAcceptNewSocket:" title="onSocket:didAcceptNewSocket:"></a>
- <h3 class="subsubtitle method-title">onSocket:didAcceptNewSocket:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>Called when a socket accepts a connection. Another socket is spawned to handle it. The new socket will have<br/>
- the same delegate and will call “onSocket:didConnectToHost:port:”.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (void)onSocket:(AsyncSocket *)<em>sock</em> didAcceptNewSocket:(AsyncSocket *)<em>newSocket</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>Called when a socket accepts a connection. Another socket is spawned to handle it. The new socket will have<br/>
- the same delegate and will call “onSocket:didConnectToHost:port:”.</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">AsyncSocket.h</code><br />
- </div>
-
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/onSocket:didConnectToHost:port:" title="onSocket:didConnectToHost:port:"></a>
- <h3 class="subsubtitle method-title">onSocket:didConnectToHost:port:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>Called when a socket connects and is ready for reading and writing.<br/>
- The host parameter will be an IP address, not a DNS name.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (void)onSocket:(AsyncSocket *)<em>sock</em> didConnectToHost:(NSString *)<em>host</em> port:(UInt16)<em>port</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>Called when a socket connects and is ready for reading and writing.<br/>
- The host parameter will be an IP address, not a DNS name.</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">AsyncSocket.h</code><br />
- </div>
-
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/onSocket:didReadData:withTag:" title="onSocket:didReadData:withTag:"></a>
- <h3 class="subsubtitle method-title">onSocket:didReadData:withTag:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>Called when a socket has completed reading the requested data into memory.<br/>
- Not called if there is an error.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (void)onSocket:(AsyncSocket *)<em>sock</em> didReadData:(NSData *)<em>data</em> withTag:(long)<em>tag</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>Called when a socket has completed reading the requested data into memory.<br/>
- Not called if there is an error.</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">AsyncSocket.h</code><br />
- </div>
-
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/onSocket:didReadPartialDataOfLength:tag:" title="onSocket:didReadPartialDataOfLength:tag:"></a>
- <h3 class="subsubtitle method-title">onSocket:didReadPartialDataOfLength:tag:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>Called when a socket has read in data, but has not yet completed the read.<br/>
- This would occur if using readToData: or readToLength: methods.<br/>
- It may be used to for things such as updating progress bars.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (void)onSocket:(AsyncSocket *)<em>sock</em> didReadPartialDataOfLength:(NSUInteger)<em>partialLength</em> tag:(long)<em>tag</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>Called when a socket has read in data, but has not yet completed the read.<br/>
- This would occur if using readToData: or readToLength: methods.<br/>
- It may be used to for things such as updating progress bars.</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">AsyncSocket.h</code><br />
- </div>
-
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/onSocket:didWriteDataWithTag:" title="onSocket:didWriteDataWithTag:"></a>
- <h3 class="subsubtitle method-title">onSocket:didWriteDataWithTag:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>Called when a socket has completed writing the requested data. Not called if there is an error.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (void)onSocket:(AsyncSocket *)<em>sock</em> didWriteDataWithTag:(long)<em>tag</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>Called when a socket has completed writing the requested data. Not called if there is an error.</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">AsyncSocket.h</code><br />
- </div>
-
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/onSocket:didWritePartialDataOfLength:tag:" title="onSocket:didWritePartialDataOfLength:tag:"></a>
- <h3 class="subsubtitle method-title">onSocket:didWritePartialDataOfLength:tag:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>Called when a socket has written some data, but has not yet completed the entire write.<br/>
- It may be used to for things such as updating progress bars.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (void)onSocket:(AsyncSocket *)<em>sock</em> didWritePartialDataOfLength:(NSUInteger)<em>partialLength</em> tag:(long)<em>tag</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>Called when a socket has written some data, but has not yet completed the entire write.<br/>
- It may be used to for things such as updating progress bars.</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">AsyncSocket.h</code><br />
- </div>
-
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:" title="onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:"></a>
- <h3 class="subsubtitle method-title">onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>Called if a read operation has reached its timeout without completing.<br/>
- This method allows you to optionally extend the timeout.<br/>
- If you return a positive time interval (> 0) the read’s timeout will be extended by the given amount.<br/>
- If you don’t implement this method, or return a non-positive time interval (<= 0) the read will timeout as usual.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (NSTimeInterval)onSocket:(AsyncSocket *)<em>sock</em> shouldTimeoutReadWithTag:(long)<em>tag</em> elapsed:(NSTimeInterval)<em>elapsed</em> bytesDone:(NSUInteger)<em>length</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>Called if a read operation has reached its timeout without completing.<br/>
- This method allows you to optionally extend the timeout.<br/>
- If you return a positive time interval (> 0) the read’s timeout will be extended by the given amount.<br/>
- If you don’t implement this method, or return a non-positive time interval (<= 0) the read will timeout as usual.</p>
- <p>The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method.<br/>
- The length parameter is the number of bytes that have been read so far for the read operation.</p>
- <p>Note that this method may be called multiple times for a single read if you return positive numbers.</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">AsyncSocket.h</code><br />
- </div>
-
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:" title="onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:"></a>
- <h3 class="subsubtitle method-title">onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>Called if a write operation has reached its timeout without completing.<br/>
- This method allows you to optionally extend the timeout.<br/>
- If you return a positive time interval (> 0) the write’s timeout will be extended by the given amount.<br/>
- If you don’t implement this method, or return a non-positive time interval (<= 0) the write will timeout as usual.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (NSTimeInterval)onSocket:(AsyncSocket *)<em>sock</em> shouldTimeoutWriteWithTag:(long)<em>tag</em> elapsed:(NSTimeInterval)<em>elapsed</em> bytesDone:(NSUInteger)<em>length</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>Called if a write operation has reached its timeout without completing.<br/>
- This method allows you to optionally extend the timeout.<br/>
- If you return a positive time interval (> 0) the write’s timeout will be extended by the given amount.<br/>
- If you don’t implement this method, or return a non-positive time interval (<= 0) the write will timeout as usual.</p>
- <p>The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method.<br/>
- The length parameter is the number of bytes that have been written so far for the write operation.</p>
- <p>Note that this method may be called multiple times for a single write if you return positive numbers.</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">AsyncSocket.h</code><br />
- </div>
-
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/onSocket:wantsRunLoopForNewSocket:" title="onSocket:wantsRunLoopForNewSocket:"></a>
- <h3 class="subsubtitle method-title">onSocket:wantsRunLoopForNewSocket:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>Called when a new socket is spawned to handle a connection. This method should return the run-loop of the<br/>
- thread on which the new socket and its delegate should operate. If omitted, [NSRunLoop currentRunLoop] is used.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (NSRunLoop *)onSocket:(AsyncSocket *)<em>sock</em> wantsRunLoopForNewSocket:(AsyncSocket *)<em>newSocket</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>Called when a new socket is spawned to handle a connection. This method should return the run-loop of the<br/>
- thread on which the new socket and its delegate should operate. If omitted, [NSRunLoop currentRunLoop] is used.</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">AsyncSocket.h</code><br />
- </div>
-
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/onSocket:willDisconnectWithError:" title="onSocket:willDisconnectWithError:"></a>
- <h3 class="subsubtitle method-title">onSocket:willDisconnectWithError:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>In the event of an error, the socket is closed.<br/>
- You may call “unreadData” during this call-back to get the last bit of data off the socket.<br/>
- When connecting, this delegate method may be called<br/>
- before"onSocket:didAcceptNewSocket:“ or "onSocket:didConnectToHost:”.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (void)onSocket:(AsyncSocket *)<em>sock</em> willDisconnectWithError:(NSError *)<em>err</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>In the event of an error, the socket is closed.<br/>
- You may call “unreadData” during this call-back to get the last bit of data off the socket.<br/>
- When connecting, this delegate method may be called<br/>
- before"onSocket:didAcceptNewSocket:“ or "onSocket:didConnectToHost:”.</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">AsyncSocket.h</code><br />
- </div>
-
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/onSocketDidDisconnect:" title="onSocketDidDisconnect:"></a>
- <h3 class="subsubtitle method-title">onSocketDidDisconnect:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>Called when a socket disconnects with or without error. If you want to release a socket after it disconnects,<br/>
- do so here. It is not safe to do that during “onSocket:willDisconnectWithError:”.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (void)onSocketDidDisconnect:(AsyncSocket *)<em>sock</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>Called when a socket disconnects with or without error. If you want to release a socket after it disconnects,<br/>
- do so here. It is not safe to do that during “onSocket:willDisconnectWithError:”.</p>
- <p>If you call the disconnect method, and the socket wasn’t already disconnected,<br/>
- this delegate method will be called before the disconnect method returns.</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">AsyncSocket.h</code><br />
- </div>
-
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/onSocketDidSecure:" title="onSocketDidSecure:"></a>
- <h3 class="subsubtitle method-title">onSocketDidSecure:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>Called after the socket has successfully completed SSL/TLS negotiation.<br/>
- This method is not called unless you use the provided startTLS method.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (void)onSocketDidSecure:(AsyncSocket *)<em>sock</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>Called after the socket has successfully completed SSL/TLS negotiation.<br/>
- This method is not called unless you use the provided startTLS method.</p>
- <p>If a SSL/TLS negotiation fails (invalid certificate, etc) then the socket will immediately close,<br/>
- and the <a href="#//api/name/onSocket:willDisconnectWithError:">onSocket:willDisconnectWithError:</a> delegate method will be called with the specific SSL error code.</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">AsyncSocket.h</code><br />
- </div>
-
-
- </div>
-
- <div class="section-method">
- <a name="//api/name/onSocketWillConnect:" title="onSocketWillConnect:"></a>
- <h3 class="subsubtitle method-title">onSocketWillConnect:</h3>
-
-
-
- <div class="method-subsection brief-description">
- <p>Called when a socket is about to connect. This method should return YES to continue, or NO to abort.<br/>
- If aborted, will result in AsyncSocketCanceledError.</p>
- </div>
-
-
- <div class="method-subsection method-declaration"><code>- (BOOL)onSocketWillConnect:(AsyncSocket *)<em>sock</em></code></div>
-
-
-
-
-
-
-
-
- <div class="method-subsection discussion-section">
- <h4 class="method-subtitle">Discussion</h4>
- <p>Called when a socket is about to connect. This method should return YES to continue, or NO to abort.<br/>
- If aborted, will result in AsyncSocketCanceledError.</p>
- <p>If the connectToHost:onPort:error: method was called, the delegate will be able to access and configure the<br/>
- CFReadStream and CFWriteStream as desired prior to connection.</p>
- <p>If the connectToAddress:error: method was called, the delegate will be able to access and configure the<br/>
- CFSocket and CFSocketNativeHandle (BSD socket) as desired prior to connection. You will be able to access and<br/>
- configure the CFReadStream and CFWriteStream in the <a href="#//api/name/onSocket:didConnectToHost:port:">onSocket:didConnectToHost:port:</a> method.</p>
- </div>
-
-
-
-
-
-
-
- <div class="method-subsection declared-in-section">
- <h4 class="method-subtitle">Declared In</h4>
- <code class="declared-in-ref">AsyncSocket.h</code><br />
- </div>
-
-
- </div>
-
- </div>
-
-
- </div>
- <div class="main-navigation navigation-bottom">
- <ul>
- <li><a href="../index.html">Index</a></li>
- <li><a href="../hierarchy.html">Hierarchy</a></li>
- </ul>
- </div>
- <div id="footer">
- <hr />
- <div class="footer-copyright">
- <p><span class="copyright">© 2013 Dustin Voss and Robbie Hanson. All rights reserved. (Last updated: 2013-04-24)</span><br />
-
- <span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.1 (build 858)</a>.</span></p>
-
- </div>
- </div>
- </div>
- </article>
- <script type="text/javascript">
- function jumpToChange()
- {
- window.location.hash = this.options[this.selectedIndex].value;
- }
-
- function toggleTOC()
- {
- var contents = document.getElementById('contents');
- var tocContainer = document.getElementById('tocContainer');
-
- if (this.getAttribute('class') == 'open')
- {
- this.setAttribute('class', '');
- contents.setAttribute('class', '');
- tocContainer.setAttribute('class', '');
-
- window.name = "hideTOC";
- }
- else
- {
- this.setAttribute('class', 'open');
- contents.setAttribute('class', 'isShowingTOC');
- tocContainer.setAttribute('class', 'isShowingTOC');
-
- window.name = "";
- }
- return false;
- }
-
- function toggleTOCEntryChildren(e)
- {
- e.stopPropagation();
- var currentClass = this.getAttribute('class');
- if (currentClass == 'children') {
- this.setAttribute('class', 'children open');
- }
- else if (currentClass == 'children open') {
- this.setAttribute('class', 'children');
- }
- return false;
- }
-
- function tocEntryClick(e)
- {
- e.stopPropagation();
- return true;
- }
-
- function init()
- {
- var selectElement = document.getElementById('jumpTo');
- selectElement.addEventListener('change', jumpToChange, false);
-
- var tocButton = document.getElementById('table_of_contents');
- tocButton.addEventListener('click', toggleTOC, false);
-
- var taskTreeItem = document.getElementById('task_treeitem');
- if (taskTreeItem.getElementsByTagName('li').length > 0)
- {
- taskTreeItem.setAttribute('class', 'children');
- taskTreeItem.firstChild.setAttribute('class', 'disclosure');
- }
-
- var tocList = document.getElementById('toc');
-
- var tocEntries = tocList.getElementsByTagName('li');
- for (var i = 0; i < tocEntries.length; i++) {
- tocEntries[i].addEventListener('click', toggleTOCEntryChildren, false);
- }
-
- var tocLinks = tocList.getElementsByTagName('a');
- for (var i = 0; i < tocLinks.length; i++) {
- tocLinks[i].addEventListener('click', tocEntryClick, false);
- }
-
- if (window.name == "hideTOC") {
- toggleTOC.call(tocButton);
- }
- }
-
- window.onload = init;
-
- // If showing in Xcode, hide the TOC and Header
- if (navigator.userAgent.match(/xcode/i)) {
- document.getElementById("contents").className = "hideInXcode"
- document.getElementById("tocContainer").className = "hideInXcode"
- document.getElementById("top_header").className = "hideInXcode"
- }
-
- </script>
- </body>
- </html>