title: iphone SDK: socket client... how do I handle the receive data delegate across different views/classes?
body: <p>I am writing a controller for an audio server on the iPhone.  Each 'view' generally needs to get data from the TCP/IP socket as a client.  I have sockets working from one class using the <a href="http://www.cocoadev.com/index.pl?AsyncSocket" rel="nofollow noreferrer">AsyncSocket</a> class.  (which, after trying to get a socket client working for more time than I'd like to admit, is a very impressive and helpful class).. This requires delegate functions to be written for recieving data...</p>
  
  <pre><code>- (void)onSocket:(AsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag
  </code></pre>
  
  <p>I have a standard table view interface where I see a list of Artists on one view, then when an artist is selected I move to the albums on the next view and so on.  </p>
  
  <p>My question is: When I go from view to view, what is the best way to still send and receive data?  Do I need to create a whole new socket for each view class?  (seems a bit over the top)  Somehow link the local receiver delegate again?  </p>
  
  <p>I can't seem to think of the 'proper' way to get this working outside of 1 class and there isn't much online about socket client communications on the iphone.</p>