|
-
Mar 9th, 2002, 08:52 AM
#1
Thread Starter
New Member
Winsock
i am writing a program and i i need to send an array of ints over the network, i can send it as a string but the fact that its a string makes it hard to work with. is there any way i can send it as an array?
-
Jul 9th, 2004, 11:07 AM
#2
Fanatic Member
If you are using C++, typecast it as a char and send it with a length of arraysize * sizeof(int)
"Can't" and "shouldn't" are two totally separate things.
All questions should be answered. All answers should be true. That is why I post.
-
Jul 14th, 2004, 11:49 AM
#3
You'd do better posting this into either the forum specific to the language you are working in.
If the array is of a fixed size, you could send each item sequentially. If the array is not fixed size (the end computer doesn't know how many ints it should receive, send the size of the array first.
Are you using TCP or UDP? This could be done pretty quickly with UDP, but TCP would be a bit more difficult. With UDP, you might send something that says "Prepare to receive array of size x" Then send all the items. If some number other than x arrives, you know a packet has been lost.
Something like that, but you probably aren't working in UDP.
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
|