Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualSimonForsman

Posted 01 August 2012 - 02:49 PM

im interested in c++


C++ doesn't have any network features and winsock is a low level library so its all up to you how to encode and send it.

one rather simple format to encode an array in would be
a header that tells the reciever that the packet contains an array with x elements of datatype y. (in a verbose plaintext format you could encode it as Array:5454:Enemy (in a binary representation you'd replace the words Array and Enemy with an integer number between 0 and the max number of different packet and datatypes supported)
and then just send 5454 Enemy objects (if they have a fixed size you can just write the member variables in a fixed order to the socket, if they have dynamic fields you need a header for each object in the array aswell)

#1SimonForsman

Posted 01 August 2012 - 02:47 PM

im interested in c++


C++ doesn't have any network features and winsock is a low level library so its all up to you how to encode and send it.

one rather simple format to encode an array in would be
a header that tells the reciever that the packet contains an array with x elements of datatype y. (in a verbose plaintext format you could encode it as Array:5454:Enemy (allthough binary representations would be far smaller)
and then just send 5454 Enemy objects (if they have a fixed sized you can just write the member variables in a fixed order to the socket, if they have dynamic fields you need a header for those aswell)

PARTNERS