System include some clients and server. Client send message to server have 3 types of message:
- Connection setup: User type command-line:  remote-chat 
<IP addr server>:<port addr server><IP address client>:<port addr client>, a link TCP connection will be established between the client and server chat. After the TCP connection is set, the client sends the connection setup information, including some fields:- The message identifier: is a 32-bit integer. With Connection setup message, this field equal to 0.
 - Field IP address of client 2 (client 1 call), Port address of client 2.
 
 
Server receive this message. Then create a connection to client 2.
- Data exchange: used to exchange data between client and server. Include some fields:
- The message identifier: is a 32-bit integer. With Data exchange message this field = 1
 - The data length: an integer indicating the length of the text message.
 - The data text field: contains text messages to exchange.
 
 
When receiving data sent from client 1, chat server transfer text messages from client 1 to client 2 (client 2 also using data exchange message).
So my question is: how do I send the message with some field? I already know send string by function send(). Here I have to send message Connection Setup or Data exchange with some field then I whether used pack in client side then unpack in server side or not? Please give me some solution for this problem?
I think use:
typedef struct _ConnectionSetup_Message
{
    int  message_ID;    // 0 ConnectionSetup message
    unsigned int Port;
    unsigned shor IP;
} HELLO_Message;
typedef struct _DataExchange_Message
{
    int  message_Length;
    int  message_ID;    // 1 for DataExchange message
    char *text;
} DataExchange_Message;