UPDATE: Looking through the protocol here, I can't figure out what goes into the Unsized Envelope Record. I can't find any examples online.

ORIGINAL:

I have the following WCF service

    static void Main(string[] args)
    {
        var inst = new PlusFiver();
        using (ServiceHost host = new ServiceHost(inst,
            new Uri[] { new Uri("net.pipe://localhost") }))
        {
            host.AddServiceEndpoint(typeof(IPlusFive), new NetNamedPipeBinding(NetNamedPipeSecurityMode.None), "PipePlusFive");
            host.Open();
            Console.WriteLine("Service is Available. Press enter to exit.");
            Console.ReadLine();
            host.Close();
        }
    }

   [ServiceContract]
   public interface IPlusFive
   {
       [OperationContract]
       int PlusFive(int value);
   }


   [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
   public class PlusFiver : IPlusFive
   {
      public int PlusFive(int value)
      {
          Console.WriteLine("Adding 5 to " + value);
          return value + 5;
      }      
   }

I output the adding 5 line so I know if the server processed the request or not.

I have a .NET client that I used to test this and everything works as expected.

Now I want to make an unmanaged C++ client for this.

I figured out how to get the name of the pipe, and write to it.
I've downloaded the protocol from here

I can write to the pipe but I can't read to it. Whenever I try to read from it I get a ERROR_BROKEN_PIPE 109 (0x6D) The pipe has been ended. error. If I replace the read with a write, the write is successful, so I don't think that the pipe is closed, at least not until I try to do a read.

Here is how I'm connecting to the

Edit
Report