Jump to content

"packet.h" Can I use vector while transferring data?


Go to solution Solved by Mali,

Recommended Posts

example:
typedef struct SPacketGCTest
{
    BYTE    bHeader;
    DWORD dwIndex;
   std::vector<const char*> vString;
} TPacketGCTest;

do you think vector will work properly?

Or do you have a suggestion that you think would be well?

badass hei GIF

  • Honorable Member

I would suggest using the common approach, the use of structs, as it has always been used and the reason behind the file @ "Srcs/Server/common/tables.h" for this purpose.

Of course, there are other ways you can do this without using vectors but if you're trying to send multiple data you could also consider and should use dynamic packets for this approach.

In the other hand, we can't guarantee that the size of the vector will be the same as the host and client and we mainly don't use it by its dynamic structure if the packet is static.

154636WhyWeDontUseVectorInPackets.png

Regardless, I'm not saying it's not possible, in fact, I haven't tried to test this but I'm sure this wouldn’t work with static packets.

Edited by Owsap
  • Good 1
  • Honorable Member
  • Solution
Spoiler

yb0c3yb.png

Spoiler

TaOHMYG.png

Spoiler

5IpEbGA.png

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Good 2
  • Love 1

 

  • Honorable Member
12 minutes ago, Mali said:
  Hide contents

yb0c3yb.png

  Hide contents

TaOHMYG.png

  Hide contents

5IpEbGA.png

 

Don't forget to mention that this will not work on static packets.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Good 2

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.