title: CFRunLoopRun() problem
body: <p>i had  a problem  on CFRunLoopRun()</p>
  
  <p>and here is the code 
  after clicking the button , it Stops in CFRunLoopRun() method for some time ,
  can any one help me wat to do next...........</p>
  
  <p>AND my MAIN Problem IS i Have to Connect With BOCA printer USing IP Address and Port Number , and  I had Done Up to Sending Messages to The BOCA, but My problem how can i get return response , or how can i Know that i was connected to Printer , And the printing message should be send when my system and BOCA printer Should connect one NETWork Connection ........  </p>
  
  <p>-(IBAction)ConnectButtonPressed</p>
  
  <p>{ if(isPrinterConnected == FALSE)</p>
  
  <p>{
      char print[] = "print";
      /* Build our socket context; this ties the joke to the socket */
      CFSocketContext CTX = { 0, print, NULL, NULL, NULL };</p>
  
  <pre><code>/* Create the server socket as a TCP IPv4 socket and set a callback */
  /* for calls to the socket's lower-level connect() function */
  TCPClient = CFSocketCreate(NULL, PF_INET, SOCK_STREAM, IPPROTO_TCP,
                             kCFSocketConnectCallBack, (CFSocketCallBack)ConnectCallBack, &amp;CTX);
  if (TCPClient == NULL)
  {
  }
  else{
  
      /* Set the port and address we want to listen on */
      struct sockaddr_in addr;
      memset(&amp;addr, 0, sizeof(addr));
      addr.sin_len = sizeof(addr);
      addr.sin_family = AF_INET;
      addr.sin_port = htons(PORT);
      //addr.
      //addr.sin_addr.s_addr = INADDR_ANY;
      addr.sin_addr.s_addr = htonl((((((10 &lt;&lt; 8) | 0) &lt;&lt; 8) | 0) &lt;&lt; 8) | 204);
  
      CFDataRef connectAddr = CFDataCreate(NULL, (unsigned char *)&amp;addr, sizeof(addr));
  
      CFSocketConnectToAddress(TCPClient, connectAddr, -1);
      CFRunLoopSourceRef sourceRef = CFSocketCreateRunLoopSource(kCFAllocatorDefault, TCPClient, 0);
      CFRunLoopAddSource(CFRunLoopGetCurrent(), sourceRef, kCFRunLoopCommonModes);
      CFRelease(sourceRef);
      CFRunLoopRun();
      NSLog(@"next line ");
  
  //isPrinterConnected = TRUE;
  
  
  //[connect setTitle: @"Disconnect" forState: UIControlStateNormal];
  }
  
  }else 
  </code></pre>
  
  <p>{
      close(sock);
      isPrinterConnected = FALSE;
      [myButton setTitle: @"Connect" forState: UIControlStateNormal];
    }</p>
  
  <p>}</p>