I have 2 problems, and if you combine them 3. ;) :P
1. How do I send a(n) (three-dimensional) array with winsock?
2. How do I send a user-defined-type with winsock?
3. How do I send an array of a user-defined-type with winsock?
Printable View
I have 2 problems, and if you combine them 3. ;) :P
1. How do I send a(n) (three-dimensional) array with winsock?
2. How do I send a user-defined-type with winsock?
3. How do I send an array of a user-defined-type with winsock?
Anyone?
I'm not sure you can.
I remember seeing code for sending objects over Winsock but I forgot where I found it, somewhere on www.pscode.com/vb
You could try declaring it as a variant and then sending the variant variable but I'm not sure that will work.
Or putting the UDT array into a file, and then reading that file back into a byte array and sending the byte array. But I would only use that if you can't find any other method.
VB Code:
Dim intFF As Integer intFF = FreeFile Open App.Path & "\temp.bin" For Binary Access Write As #intFF Put #intFF, 1, MyUDTArray() Close #intFF intFF = FreeFile Dim bytData() As Byte Open App.Path & "\temp.bin" For Binary Access Read As #intFF Get #intFF, 1, bytData() Close #intFF Winsock.SendData bytData()
I read something about copymemory/rtlmovememory being able to flatten arrays, but I can't do it...
Hello?
Read this article from MSDN:
HOWTO: Send and Receive UDT's Using the Winsock Control
Thnx, I know that now...
Question 1 and 3 left. :P