title: Can you pass a Stream object to a method to write to that specific stream?
body: <p>I currently have a server and two clients which communicate with it. Each time a client connects to the server, I store the <code>Stream</code> instance as a value and a client ID as a key in a concurrent dictionary.</p>
  
  <pre><code>private static ConcurrentDictionary&lt;string, NetworkStream&gt; pumpIDAndStream = new ConcurrentDictionary&lt;string, NetworkStream&gt;();
  
  //then later in the program
  
  pumpIDAndStream.AddOrUpdate(clientID.ToString(), stream, (k, v) =&gt; stream);
  </code></pre>
  
  <p>I then use this method to try and send a message to a specific client instance based on the stream object stored in the dictionary:</p>
  
  <pre><code>private void proceedPump(byte[] b_recievedLine)
  {
  
      string s_messageBody = DESDecrypt(b_recievedLine, DCSP);
      string[] delim = { " " };
      string[] strings = s_messageBody.Split(delim, StringSplitOptions.RemoveEmptyEntries);
  
  
      NetworkStream pumpStream = pumpIDAndStream[(strings[0])]; //strings[0] is the specific client ID
      byte[] empty = System.Text.Encoding.ASCII.GetBytes(""); 
  
      pumpStream.Write(messageFormatting(empty, 0x14, DCSP), 0, empty.Length);
      pumpStream.Flush();
  
  }
  </code></pre>
  
  <p>After debugging, it does get to the <code>pumpStream.Flush();</code> but nothing is picked up on the specific client. Any pointers?</p>