GalileoSky GLONASS/GPS v5.1 (223) User’s ManualGalileoSky Ltd Page 8212. Server exchange protocolThis protocol supports bi-directional data exchange between the terminal and the server. The data aretransmitted via GPRS channel with the use of TCP/IP protocol. The server must have static address and portfor connecting terminals as clients.Data transmission from the terminal to the server:After establishing terminal-server connection the device sends head pack and then main packs with the data.Each pack needs confirmation from the server; if confirmation is not received, the terminal sends the packonce again.Note that TCP/IP is a stream protocol, i. e there are no packets of the TCP/IP level for the application serversoftware. Reading from the TPC/IP-socket is a reading of the bytes stream but not reading of the packets.The GalileoSky protocol packets are not ones of the application level, and for their correct parsing serversoftware has to select a buffer and capture the packet. In no case, it is possible to rely on the fact that oneread operation from the socket returns the whole GalileoSky protocol packet. The whole GalileoSky protocolpacket can be received after executing some sequential read operations, there can be time intervals betweenthem, it is connected with the operation aspects of the TCP/IP protocol.Head pack structure:Field SizeHeader 0x01 1 bytePacket length 2 bytesTag 1 1 byteData, corresponding to tag 1 depends on the tag type…Tag N 1 byteData, corresponding to tag N depends on the tag typeChecksum 2 bytesA high-order bit is an indicator of not transferred data in the archive, 15 low-order bits are the number ofbytes in the packet. Maximum packet length is 1000 bytes.Transmitted tags are set by HeadPack command. Packet length is calculated from the head tag to checksumbeginning. Tags are in ascending order. The data and the checksum are transferred in little-endian format.The Checksum is calculated for the whole packet including the header, length field and indicator of unsentdata. The Checksum is calculated by CRC-16 Modbus algorithm, you can find an example of its realization inhttp://www.modbus.org/docs/Modbus_over_serial_line_V1_02.pdf .Terminal ServerFirst packet (HeadPack)Head packet receiving confirmationMain packet (MainPack) Main packet (MainPack)Main packet receiving confirmationMain packet receiving confirmation