title: CocoaAsyncSockets creating Connection on app startup but Reading/Writing from a view(s)
body: <p>I am using the CocoaAsyncSockets library in order to create a tcp socket connection in my app.  Currently, I have successfully created a connection by opening the socket connection in my didFinishLaunchingWithOptions method in my appDelegate.m file.  My code looks like so:</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's my connect method:</p>
  
  <pre><code>- (void)connect 
  {
      [socket connectToHost:@"9.5.3.6" onPort:11005 error:nil];
  }
  </code></pre>
  
  <p>Now, what I have been struggling with is how to use read/write methods in my views without having to re-establish a connection.  </p>
  
  <ul>
  <li>I have established a tcp socket connection when the application launches</li>
  <li>I open the socket in the didFinishLaunchWithOptions method so that I can create the connection and stay connected the entire time my app is running</li>
  <li>I don't know how to read/write from/to the server from my views</li>
  <li>I'm very new to socket/iOS development, so I'm hoping for the easiest possible solution</li>
  </ul>
  
  <p>I would appreciate any help I can get on this.  I'm still pretty new to iOS and still picking up on the syntax, so the more details anyone can provide, the better off I'll be.</p>
  
  <p>Thanks so much for the help!</p>