Method that returns number of bytes available in TCP/IP socket
<p><code>socket.Available</code> does not work. Why? </p>

<p>Instead of <code>size</code> I need to use <code>socket.Available</code>. But it does not work. So I need a method that returns the number of bytes in socket.</p>

<pre><code>void Receive(Socket socket, byte[] buffer, int offset, int size)
{
    //int sockAvail = socket.Available;  Here socket.Available always asigns 0 to sockAvail
    int received = 0;

    do
    {
       try
       {
          received += socket.Receive(buffer, offset + received, size - received, SocketFlags.None);
       }
       catch (Exception e) 
       { 
          Console.WriteLine(e.Message); 
       }

    } while (received &lt; size);

    MessageBox.Show(socket.Available.ToString());
 }
</code></pre>
