title: CocoaAsyncSockets seems to be failing when calling onSocket:didReadData:withTag
body: <p>for some reason when I try to call CocoaAsyncSocket's onSocket:didReadData:withTag method, it's failing and not showing data from the read.  </p>
  
  <p>appDelegate:</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {   
      NSError *error = nil;
      if (![socket connectToHost:@"199.5.83.63" onPort:11005 error:&amp;error]) 
      {
          NSLog(@"Error connecting: %@", error);
      }
  
      [socket readDataWithTimeout:10 tag:1];
  
      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 are my methods from the CocoaAsyncSocket Library:</p>
  
  <pre><code>- (void)onSocket:(AsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag
  {
      NSData *strData = [data subdataWithRange:NSMakeRange(0, [data length])];
      NSString *msg = [[NSString alloc] initWithData:strData encoding:NSUTF8StringEncoding];
      NSLog(@"RX length: %d", [data length]);
      if(msg)
      {
          NSLog(@"RX:%@",msg);
      }
      else 
      {
          NSLog(@"Fail");
      }    
  }
  
  - (void)onSocket:(AsyncSocket *)sock willDisconnectWithError:(NSError *)err
  {
      NSLog(@"error - disconnecting");
      //start reconnecting procedure here...
  }
  
  - (void)onSocketDidDisconnect:(AsyncSocket *)sock
  {
      NSLog(@"disconnected");
  }
  
  - (void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port
  {
      NSLog(@"connected");
  }
  </code></pre>
  
  <p>When I run my app in the simulator, this is what my output log spits out:</p>
  
  <pre><code>2012-06-08 13:17:30.808 tekMatrix[2793:f803] connected
  2012-06-08 13:17:30.815 tekMatrix[2793:f803] RX length: 8
  2012-06-08 13:17:30.816 tekMatrix[2793:f803] Fail
  </code></pre>
  
  <ul>
  <li>onSocket:didConnectToHost:port is called, and NSLog spits out "connected".</li>
  <li>onSocket:didReadData:withTag is called, and NSLog spits out "RX length: 8".</li>
  <li>also in onSocket:didReadData:withTag, NSLog spits out "Fail".</li>
  </ul>
  
  <p>Correct me if I'm wrong, but it shouldn't "msg" contain the value of the data read from the server?  It looks like the Data Read knows that it's expecting a data length of 8, but the data doesn't seem to get stored into the string.  I'm very new to iOS and especially socket programming, so this is all new to me.  Any help on this subject would be greatly appreciated.</p>
  
  <p>Thanks!</p>