title: GCDAsyncSocket - not receiving data - AsyncSocket works ok
body: <p>I made an iPhone client connect to a server using GCDAsyncSocket.  The server is running .Net on a Windows server. The connect is good and it sends data well too.</p>
  
  <p>I then tell the client to go into receive directly after the send... </p>
  
  <pre><code>[sock readDataToData:[GCDAsyncSocket LFData] withTimeout:15 tag:1]; 
  </code></pre>
  
  <p>I also have this set up to receive:</p>
  
  <pre><code>- (void)onSocket:(GCDAsyncSocket *)sock didReadData:(NSData *)data 
  withTag:(long)tag 
  </code></pre>
  
  <p>and also:</p>
  
  <pre><code>   - (NSTimeInterval)socket:(GCDAsyncSocket *)sock shouldTimeoutReadWithTag:(long)tag 
  </code></pre>
  
  <p>If I wait for the time out the time out method is called. </p>
  
  <p>If I send data from the server, the timeout is not called, so I assume 
  the client has seen something, but there is no indication of that on 
  the client side. </p>
  
  <p>I also added: </p>
  
  <pre><code>- (void)socket:(GCDAsyncSocket *)sock didReadPartialDataOfLength: (NSUInteger)partialLength tag:(long)tag 
  </code></pre>
  
  <p>hoping I would see a partial packet but this does not get triggered 
  either.  </p>
  
  <p>As I mentioned above the timeout does not trigger if I send 
  something from the server to the client.  However I would have thought 
  it would also timeout if it hasn't received the terminator 
  character.   I also tried reading with a length of 3 but that didnt 
  make any difference. </p>
  
  <p>The GCDAsyncSocket is the the problem. AsyncSocket seems to work ok.</p>
  
  <p>Maybe its the init is wrong?</p>
  
  <p>dispatch_queue_t mainQueue = dispatch_get_main_queue();</p>
  
  <p>asyncSocket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:mainQueue]</p>
  
  <p>Any ideas what I did wrong? </p>
  
  <p>I put a post on the goggle code for this but there isnt any activity so not sure if I will get an answer or not.</p>
  
  <p>Ideally if anyone has a sample code that the receives works that would be great!  thank you!</p>