Click to See Complete Forum and Search --> : array and user-defined-types
Compact3
Dec 27th, 2006, 05:15 AM
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?
Compact3
Dec 27th, 2006, 12:17 PM
Anyone?
DigiRev
Dec 27th, 2006, 12:56 PM
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.
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()
Compact3
Dec 27th, 2006, 02:02 PM
I read something about copymemory/rtlmovememory being able to flatten arrays, but I can't do it...
Compact3
Dec 28th, 2006, 11:13 AM
Hello?
RhinoBull
Dec 28th, 2006, 01:28 PM
Read this article from MSDN:
HOWTO: Send and Receive UDT's Using the Winsock Control (http://support.microsoft.com/kb/152058)
Compact3
Dec 28th, 2006, 01:38 PM
Thnx, I know that now...
Question 1 and 3 left. :P
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.