|
-
Feb 21st, 2004, 10:55 AM
#1
Thread Starter
Hyperactive Member
Sending Arrays through Winsock??
ye....
you got the question in Subject..
-
Feb 21st, 2004, 12:41 PM
#2
If it's a byte array, you can convert the array to string with StrConv function, if it's an array of any other type, you can calculate the total ammount of memory in bytes, then with CopyMemory API, you can copy the memory to a byte array, and then conver to string.
Obviously when you receive the data, you have to do the reverse...
-
Feb 21st, 2004, 01:21 PM
#3
Addicted Member
How to do it . . .
Well i dont fully understand your question, you are a little vague but if you mean sending every string in an array with delimiters then:
VB Code:
For i = 0 to UBound(ArrayName)
Winsock1.SendData ArrayName(i) & "DELIMITER"
DoEvents
Next i
Hope that helps
I suck with graphics. Can you help me out? If you are good with graphics there are rewards . . . email me, [email protected] . . .
[img src="www.cel-eration.com/anim1.gif"][/img]
-
Feb 21st, 2004, 01:27 PM
#4
The picture isn't missing
you should be able to just send the array through, like
VB Code:
dim arr(2) as string
arr(0) = "hi"
arr(1)="hello"
arr(2)="bye"
winsock1.senddata arr
and in the recieve part,
VB Code:
dim arr() as string
winsock1.getdata arr,vbarray
of course I could be wrong.
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Feb 21st, 2004, 02:18 PM
#5
the best way to do it would be to uses a dilemiter, if you are unsure of what these are theres a tuturiol on
www.winsockvb.com
basicly you loop through the array sending each 'bit' then on the other end recieve it and split the data up (this is also shown on winsockvb.com!)
if you need any more guidence on this topic please post back i'd be happy to fully explain it to you
PINO-
-
Feb 21st, 2004, 07:58 PM
#6
-
Feb 22nd, 2004, 12:05 AM
#7
Member
Ah I love C++ with its crazy pointer typecasting Makes life so simple. "send(sockt, (char*)anythingYouWant, itsLengthInBytes, 0);"
writing software in C++ is like writing software in VB, except that it's slower and harder and more frustrating and more finicky and doesn't give you nice convenient shortcuts on a silver platter. And it's better. *puts on heat-reflecting armor*
-
Feb 22nd, 2004, 12:08 AM
#8
The picture isn't missing
Originally posted by HunterGuy2
Ah I love C++ with its crazy pointer typecasting Makes life so simple.
WE DON'T CARE. This is a VB forum. NOT C++ forum. We are trying to find solutions in VB. Unless it is impossible to do in VB, don't tell us about how C++ is better.
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Feb 22nd, 2004, 04:24 AM
#9
Thread Starter
Hyperactive Member
Well.... but if I turn a bit.....
How do the XML stuff work???
Should I send the xml as a file....then how do I open it in VB??
-
Feb 22nd, 2004, 10:13 AM
#10
Frenzied Member
Originally posted by CVMichael
If it's a byte array, you can convert the array to string with StrConv function, if it's an array of any other type, you can calculate the total ammount of memory in bytes, then with CopyMemory API, you can copy the memory to a byte array, and then conver to string.
Obviously when you receive the data, you have to do the reverse...
FWIW, the Winsock control can pass byte arrays. There is no need to convert to and from a string.
-
Feb 22nd, 2004, 02:35 PM
#11
Member
WE DON'T CARE. This is a VB forum. NOT C++ forum. We are trying to find solutions in VB. Unless it is impossible to do in VB, don't tell us about how C++ is better.
Sorry. *sticks hand in a bucket of icewater, hoping it won't need to be amputated*
writing software in C++ is like writing software in VB, except that it's slower and harder and more frustrating and more finicky and doesn't give you nice convenient shortcuts on a silver platter. And it's better. *puts on heat-reflecting armor*
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|