title: Running server and client in 2 blocks via dispatch queues
body: <p>I want to write an App, that can run two different "threads", one for a Server one for a Client. I have heard, that in Objective-C Dispatch Queues and Blocks are the way to go. I have read the Apple Documentation about Blocks and Dispatch Queues to quite a large extend, however I still fail at the very beginning of my coding.</p>
  
  <p>Am I right, that I need to create 2 Blocks, one for my server code and one for my client code and then put those blocks in the dispatch queue to run concurrently?</p>
  
  <p>I was now trying to create a block for my server, and failed miserably. I tried the following:</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  @interface Server : NSObject {
      void (^server)(NSString*, int);
  }
  
  @end
  </code></pre>
  
  <p>And then</p>
  
  <pre><code> #import "Server.h"
  
  @implementation Server
     server = ^(NSString* host, int port) {
  };
  
  @end
  </code></pre>
  
  <p>I thought I would have to declare the block variable first in a header file, so that I can later refer to it in my ViewController. Any answers about the general structure with some code examples would be highly appreciated :) </p>