title: half open socket
body: <p>In node.js, it is possible to have a half-open socket. This means that the socket can become read or write only without closing the whole socket. An example for this:</p>
  
  <pre><code>var net = require("net");
  net.createServer({allowHalfOpen:true},function(c){
      c.on("data",function(d){
          console.log(d+"");
      });
      c.on("end",function(){
          console.log("ended");
          c.end("thx");
      });
  }).listen(888);
  
  var c = net.connect(888,function(){
      c.end("hi");
      c.on("data",function(d){
          console.log(d+"");
      });
      c.on("end",function(){
          console.log("ended");
      });
  });
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>hi
  ended
  thx
  ended
  </code></pre>
  
  <p>Is there a way in C# to close only one direction of the socket? Also, is there a way to know if a socket is readable but not writable and vice versa?</p>