4. TCP/IP Communication between Client and Server

General structure of a mig33 TCP packet. All packets from both client and server use this structure:

Table 1. Packet structure

LengthContent (if fixed)NameDescription
1 byte02MAGICIdentifies the packet as a mig33 packet.
2 bytesxx xxCOMMAND1High two bytes part of the command code for type of packet.
2 bytesxx xxCOMMAND2Low two bytes part of the command code for type of packet.
4 bytesxx xx xx xxPACK_LENThe length of the payload after this point.
variable PARAMSVarable length data specific to a certain command.

The PARAMS portion of the packet contains a list of block structures. The structure of each block is as follows:

Table 2. Block structure

LengthNameDescription
2 bytesIDThe ID number of the block.
4 bytesLENGTHThe length of the block.
variableCONTENTThe contents of the block.

4.1. Client commands

The following commands are available for the client to send to the server:

Table 3. Client commands

High command bytesLow command bytesNameDescription
00 02 (2)xx xxKEEP_ALIVEThe keep alive packet.
00 64 (100)00 02 (2)REGISTERThe registration packet
00 C8 (200)00 01 (1)LOGIN_1The initial login packet
00 CA (202)00 02 (2)LOGIN_RESPLogin response to challenge packet sent by server.
01 90 (400)00 03 (3)GET_CLISTGet contact list.
01 F4 (500)00 06 (6)SEND_MSGSend a message to an entity (chat room or contact)
03 8E (910)00 06 (6)SEND_PIC_REQUESTTell the mig33 server that you wish to send a picture.

Not yet described in detail

Table 4. Undocumented client commands

High command bytesLow command bytesNameDescription
02 BC (700)00 04 (4) Possibly related to list of chat rooms.
02 BF (703)00 05 (5) Chat related. Join room?

4.2. Server commands

The following commands can be sent from the server to the client, either as a response to a client command, or to notify the client of some event.

Table 5. Server commands

High command bytesLow command bytesNameDescription
00 00 (0)00 00 (0)ERROR_MESSAGEA packet that notifies the client of an error.
00 00 (0)00 01 (1)LOGIN_NOTIFYA packet that notifies the client that the server is down, or under going maintanence.
00 00 (0)00 02 (2)LOGIN_BAD_RESPLogin failure message when Client sends a bad LOGIN_RESP packet.
00 01 (1)00 02 (2)REGISTER_OKThe message that the server sends when registration (the REGISTER packet) is successful.
00 03 (3)xx xxKEEP_ALIVE_RESPThe keep alive response packet.
00 C9 (201)00 01 (1)LOGIN_CHALLogin challenge sent from server to client after receiving LOGIN_1 packet.
00 CB (203)00 02 (2)LOGIN_OK / MOTDLogin OK message with message of the day
01 91 (401)00 03 (3)CLIST_GROUPSPacket sent with groups after requesting contact list.
01 92 (402)00 03 (3)CLIST_BUDDIESPacket sent with buddies after requesting contact list.
01 93 (403)00 03 (3)CLIST_TERMINATORPacket sent to tell mig33 that the contact list is sent.
01 94 (404)00 00 (0)CLIST_STATUS_CHANGEPacket sent to tell mig33 that the status of someone on your buddy list has changed.
01 F4 (500)00 00 (0)RECV_MSGReceive a message from an entity. (Chatroom or contact)
01 F6 (502)00 00 (0)RECV_SYS_MSGReceive a system message