public static int ReadBytes(IntPtr socket, byte[] buffer, int offset, int byteCount)
        {
            //Debug.Assert(buffer.Length >= offset + byteCount);

            Debug.Assert(buffer.Length >= (offset + byteCount));

            Debug.WriteLine("Read: buf=" + buffer.Length + " offset=" + offset + " count=" + byteCount);
            // System.Threading.Thread.Sleep(500);
            var bufferHandle = Microsoft.Phone.InteropServices.GCHandle.Alloc(buffer, GCHandleType.Pinned);

            Debug.WriteLine("Reading " + byteCount + " from " + socket.ToInt32());
            int ret;

            m_netSocketInterface.ReadBytes(socket, new IntPtr(bufferHandle.AddrOfPinnedObject().ToInt32() + offset), byteCount, out ret);
            Debug.WriteLine(" --> Read " + ret);
            // System.Threading.Thread.Sleep(500);
            if (ret == SocketsApi.SOCKET_ERROR)
            {
                // Debug.WriteLine("There has been an error! ------------");
                Debug.WriteLine("Err: " + SocketsApi.GetLastError());
            }
            bufferHandle.Free();
            //  Debug.WriteLine("Handle Free");
            return(ret);
        }