0

What is the best way for me to send and int[999999] accross a socket? When I just plug in the pointer to the array I get this error: Error 1 error C2664: 'send' : cannot convert parameter 2 from 'int (*)[999999]' to 'const char *'

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by wildgoose
0

Are you trying to send the entire array or one element?

Sockets deal in chars!

int ary[100];
// send one integer in the array
send( hSock, (char *)&ary[3], sizeof(int), 0 );

If sending the entire array, IT's TOO BIG!!!
However if sending in chunks

// Send 100 integers
send( hSock, (char *)ary, sizeof(int) * 100, 0 );
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.