Basically here is what I ended up doing, it may not be the best way of doing it but its working perfectly (Im not super familiar with C++ yet I could not get the vector solution to work)
I have a large char SendBuffer[MAX_PACKET_SIZE];
anytime I had a packet I memcpy the struct to my buffer like so
memcpy(p->SendPacketBuffer,(char*)&mypacket,sizeof(PACKETID2));
then when im getting ready to send it to the client I do this
the first WORD in my packet is always the size so I take that out like so
WORD* PTR_Size = (WORD*)p->SendPacketBuffer;WORD PacketSize = *PTR_Size;
then I send it like so
int bytessent = send(p->s,(char*)&p->SendPacketBuffer, PacketSize, NULL);
then I make sure data got sent and if it did then I do this
char temp[MAX_SENDPACKET];memcpy(temp,(char*)&p->SendPacketBuffer + bytessent, sizeof(p->SendPacketBuffer -bytessent));memcpy(p->SendPacketBuffer,temp,MAX_SENDPACKET);
seems to be working pretty good, any major flaws with using this method?
when I get the data on my client I dump everything into the same type of buffer get the first WORD and if I have enough data to fill out my struct I typecast it to the packettype struct and use it.