HTTP Requesting with eVC++ 3.0 on Windows CE 3.0 - Protocols and Packets (Page 2 of 4 )
TCP/IP, as you are well aware, is the most widely used network protocol. Since we are working with WinCE 3.0 or Windows CE 3.0, you should be aware that TCP/IP is the only protocol supported as standard. The TCP/IP protocols are accessed via Sockets.
TCP/IP was developed so solve the problem of inconsistent network protocols. The two protocols were designed by the Department of Defense (DoD) to create a network of networks, which we call the Internet. The TCP and IP protocols will be discussed separately.
The Internet Protocol (IP)
Basically, to exchange data from one computer to another, both computers must be using the same protocol. So there needs to be a standard protocol that each system uses so that data is available on every terminal. The standard protocol is IP for communicate over the internet. Each terminal has an IP address and, by use of a modem, can send and retrieve data to any other terminal using the TCP/IP protocol.
The Internet Protocol (IP) is the most common network protocol supporting applications processing data. The main purpose of this protocol is to transmit network packets from one terminal to another. This is done by forwarding each packet, which is based on a four byte destination address (i.e. the IP address).
See RFC791 for more details.
TCP asks as the governor of a packet delivery. Problems may arise when a packet is sent over the network. This is where TCP steps in. If a packet is undelivered, TCP assures that the packet is resent. This process will continue until the end user destination terminal receives the packet and acknowledges a successful transaction.
As stated previously, the TCP/IP protocol transmitted packets. So, letís go through the elements needed from a packet so that you have a reasonable understanding about the technology used Windows CE OS.
The fields contained in the header, and their functions, are:
Internet Header Length (IHL)
Type of Service (TOS)
Version Number: This specifies the IP version of the packet. The current version of IP is version 4, so this field will contain the binary value 0100.
Internet Header Length (IHL): This specifies the length of the datagram header in 32 bit, which is 4 octets, words. The minimum-length header is 20 octets. This means that this field always has a value of at least 5 (i.e. 0101). The maximum value of this field is 15. The IP Header is a maximum of 60 octets.
Type of Service (TOS): Allows an originating host to request different classes of service for packets it transmits.
Total Length: Indicates the length (in bytes, or octets) of the entire packet, including both header and data. The maximum size of an IP packet is 64 KB, which is 65,535 bytes.
Identification: This is used when a packet is fragmented into smaller pieces sent via the Internet. This identifier is assigned by the sender so that different fragments arrive at the destination terminal and is able to be associated with each other for reassembly.
Flags: This field is also used for fragmentation and reassembly. There are three fragments.
The first bit is called the More Fragments (MF) bit, and is used to indicate the last fragment of a packet so that the receiver knows that the packet can be reassembled.
The second bit is the Don't Fragment (DF) bit, which suppresses fragmentation.
The third bit is unused (and always set to 0).
Fragment Offset: Indicates the position of this fragment in the original packet.
The offset will be zero in the first packet of a fragment stream.
In the other fragments, the offset in increments of 8 bytes.
Time-to-Live (TTL): A value from 0 to 255, indicating the number of hops that this packet is allowed to take before discarded within the network. The packet will be discarded if a router gets a zero value.
Note: Every router that receives the packet will decrement the TTL value by one hop.
Protocol: Indicates the higher layer protocol contents of the data carried in the packet; options include TCP, which is valued at 6.
Header Checksum: Carries information to ensure that the received IP header is error-free. Remember that IP provides an unreliable service and, therefore, this field only checks the header rather than the entire packet.
Source Address: Represents the IP address of the sender of the packet.
Destination Address: Represents the IP address of the host intended to receive the packet.
Packet Options: A set of requirements on the path the packet takes through the network (i.e. source route). The route taken by a packet may be traced (i.e. record route) and packets may be labelled with security features.
Now, let's find out how to use this technology to make HTTP Requests.