Can anyone tell me: "How To Construct A Header?" I am writing an FTP Client-Server Code. And I want to add a Header at Client Side for all data packets I have to send to server with information like the size of my data,etc.
I have seen some examples at SO but cant' figure out the exact way. Any pointers towards sample/example code would be appreciated.
Define a struct with members you want to be in your Header at both Client-Server( Better to include a Header file with the struct in both ). Send the Header prior to original message. recv at server with parameter of the fixed length of struct.
typedef struct
{
DWORD dwMsgType ;
DWORD dwMsgSize ;
}MSG_HEADER, *PMSG_HEADER ;