title: Send propertybag over winsock?
body: <p>I am having trouble sending a <code>propertybag</code> over <code>winsock</code>. I have a client/server application that sends images through using a <code>propertybag</code>. I convert the <code>propertybag</code> into a byte array and try to send it over <code>winsock</code> and then when I convert the byte array back to a <code>propertybag</code>, it cant seem to read it. It looks like the data was corrupted when it was sent.</p>
  
  <p><strong>Client(sending propertybag)</strong></p>
  
  <pre><code>Dim pb As PropertyBag
  Dim byt() As Byte
  
  Set pb = New PropertyBag
  
  pb.WriteProperty "picc", Image1.Picture
  byt = pb.Contents
  
  Winsock1.SendData byt
  </code></pre>
  
  <p><strong>Server(Receiving propertybag)</strong></p>
  
  <pre><code>   Dim byt() As Byte
     Dim pb As PropertyBag
  
     Set pb = New PropertyBag
  
     Winsock1.GetData byt, vbByte
  
     pb.Contents = byt
     Image1.Picture = pb.ReadProperty("picc")
  </code></pre>
  
  <p><strong>The error I received:</strong></p>
  
  <pre><code>Run-time error '327':
  Data value named 'picc' not found
  </code></pre>
  
  <p>When I try to do execute the code in a single program without <code>winsock</code>, it works just fine. The problem occurs when I send the byte array over <code>winsock</code>. </p>