title: How do I read data using CocoaAsyncSocket?
body: <p>I have created a <em>TCP Socket connection</em> in my appDelegate <code>didFinishLaunchingWithOptions</code> method.  That was the easy part, and I have successfully connected to my server.  I am having great difficulty with reading the data from the server in my View.  I have been looking through tutorials on how to appropriately (step by step) read data using <strong>CocoaAsyncSocket</strong>, but I haven't come across anything useful.  </p>
  
  <p>This is my code from my appDelegate:</p>
  
  <pre><code>-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
      socket = [[AsyncSocket alloc] initWithDelegate:self];
      [self connect];
  
      self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
      // Override point for customization after application launch.
      self.viewController = [[[tekMatrixViewController alloc] initWithNibName:@"tekMatrixViewController" bundle:nil] autorelease];
      self.window.rootViewController = self.viewController;
      [self.window makeKeyAndVisible];
      return YES;
  } 
  </code></pre>
  
  <p>And here is my connect method, at the bottom of the appDelegate file:</p>
  
  <pre><code>- (void)connect 
  {
      [socket connectToHost:@"9.5.3.3" onPort:11005 error:nil];
  }
  </code></pre>
  
  <p>That was the easy part.  I now need to read data from the server.  I know some kind of <strong>NSData</strong> or <strong>NSMutableData</strong> object needs to be created for to take the value of the data I read from the server.  I just have been very unsuccessful in finding any tutorial or documentation that points me in the right direction.  There are several different read functions, some with different parameters, etc.  If anyone could point me to a resource that goes over this in depth*(I am a newbie, after all =P)* I would really appreciate it -- Or if somebody knows of an easy way to accomplish this goal and wouldn't mind providing sample code here :D</p>
  
  <p>This is the library I'm using:  <a href="https://github.com/robbiehanson/CocoaAsyncSocket/tree/master/RunLoop" rel="nofollow">CocoaAsyncSocket</a>.  I'm using the library <code>AsyncSocket.h</code> and <code>AsyncSocket.m</code></p>
  
  <p>I've been stuck at this for hours, so any help would be great appreciated.  </p>
  
  <p>Thanks!</p>