Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21273

Help:

$
0
0
I am having trouble sending a propertybag over winsock. I have a client/server application that sends images through using a propertybag. I convert the propertybag into a byte array and try to send it over winsock and then when I convert the byte array back to a propertybag, it cant seem to read it. It looks like the data was corrupted when it was sent.

Client(sending propertybag)

Code:

Dim pb As PropertyBag
Dim byt() As Byte

Set pb = New PropertyBag

pb.WriteProperty "picc", Image1.Picture
byt = pb.Contents

Winsock1.SendData byt


Server(Receiving propertybag)


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")

The error I received:

Run-time error '327':
Data value named 'picc' not found

When I try to do execute the code in a single program without winsock, it works just fine. The problem occurs when I send the byte array over winsock. Can someone please help?

Viewing all articles
Browse latest Browse all 21273

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>