Howto? split and use a char array
Hello people on this forum.. this is my first post here, but i'm sure i will post more and more as I'm working on a project with several students.. I hope I can learn a lot here. C++ isn't my first language to work with, so i might ask some silly questions..
I have a server application written in c++, and a flash client. Currently I have managed to create a connection between the 2 programs.. They are meant to communicate with eachother. this works.
The problem I have encountered is the following..
Whenever i receive a package from the client i need to break this into several parts.. The problem is that all the packages are different sizes and the only thing they have in common at the moment is that the first two bytes are used to determine the package type.. Now i want to know how i can split the package the server receives, determine what kind of package it is, and discard the first two bytes. then send the data to the appropriate part of the application.
The package is received through tcp and is saved to a char array..
All the help is welcome, and if you need/want more information, let me know and i'll see what i can do.