title: C# - NetworkStream Error - "The operation is not allowed on non-stream oriented sockets."
body: <p>I am trying to connect to a socket and then Read a NetworkStream.</p>
  
  <p>My code is below:</p>
  
  <pre><code>NetworkStream myNetworkStream;
  Socket socket;
  
  socket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IPv4);
  
  socket.Connect(IPAddress.Parse("8.8.8.8"), 8888);
  
  myNetworkStream = new NetworkStream(socket);
  
  byte[] buffer = new byte[1024];
  int offset = 0;
  int count = 1024;
  
  myNetworkStream.Read(buffer, offset, count);
  </code></pre>
  
  <p>When I try to debug the above I get the following error:</p>
  
  <blockquote>
    <p>The operation is not allowed on non-stream oriented sockets.</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks</p>