c++ / c# Problem in named pipe
<p>This is my c++ code</p>

<pre><code>HANDLE hPipe = ::CreateNamedPipe(_T("\\\\.\\pipe\\FirstPipe"),
                                 PIPE_ACCESS_DUPLEX,
                                 PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE,
                                 PIPE_UNLIMITED_INSTANCES,
                                 4096,
                                 4096,
                                 0,
                                 NULL);

ConnectNamedPipe(hPipe, NULL);

DWORD bytesWritten = 0;
WriteFile(hPipe, lpBuffers, sizeof(LPWSABUF), &amp;bytesWritten, NULL);//LPWSABUF is structure and lpBuffers is a variable of this structure
</code></pre>

<p>This is my C# code</p>

<pre><code>uint dataLen = (uint)(br.ReadInt32());
string len = (dataLen).ToString();
listBox1.Items.Add(len);                        
IntPtr dataAdd = IntPtr.Zero;
string data = "";
if (IntPtr.Size == 4) dataAdd = (IntPtr)br.ReadInt32(); //ERROR
else dataAdd = (IntPtr)br.ReadInt64();
byte[] b = new byte[(int)dataLen];
Marshal.Copy(b, 0, dataAdd, (int)dataLen);
data = Encoding.Unicode.GetString(b);
listBox2.Items.Add(data);
</code></pre>

<p>In sixth line of C# code giving error. 
That End of the stream. I dont have any idea why it is giving error.</p>

<p>Here is the structure </p>

<pre><code>typedef struct _WSABUF {
    ULONG len;     /* the length of the buffer */
    __field_bcount(len) CHAR FAR *buf; /* the pointer to the buffer */
}  WSABUF, FAR * LPWSABUF;
</code></pre>
