Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/external/enet/docs/design.dox @ 10963

Last change on this file since 10963 was 7459, checked in by adrfried, 14 years ago

Merged ipv6 branch

Orxonox now includes a modified version of ENet 1.3.0

  • Property svn:eol-style set to native
File size: 5.9 KB
RevLine 
[7328]1/**
2@page Features Features and Architecture
3
4ENet evolved specifically as a UDP networking layer for the
5multiplayer first person shooter Cube. Cube necessitated low latency
6communcation with data sent out very frequently, so TCP was an
7unsuitable choice due to its high latency and stream orientation. UDP,
8however, lacks many sometimes necessary features from TCP such as
9reliability, sequencing, unrestricted packet sizes, and connection
10management. So UDP by itself was not suitable as a network protocol
11either. No suitable freely available networking libraries existed at
12the time of ENet's creation to fill this niche.
13
14UDP and TCP could have been used together in Cube to benefit somewhat
15from both of their features, however, the resulting combinations of
16protocols still leaves much to be desired. TCP lacks multiple streams
17of communication without resorting to opening many sockets and
18complicates delineation of packets due to its buffering behavior. UDP
19lacks sequencing, connection management, management of bandwidth
20resources, and imposes limitations on the size of packets. A
21significant investment is required to integrate these two protocols,
22and the end result is worse off in features and performance than the
23uniform protocol presented by ENet.
24
25ENet thus attempts to address these issues and provide a single,
26uniform protocol layered over UDP to the developer with the best
27features of UDP and TCP as well as some useful features neither
28provide, with a much cleaner integration than any resulting from a
29mixture of UDP and TCP.
30
31@section CM Connection Management
32
33ENet provides a simple connection interface over which to communicate
34with a foreign host. The liveness of the connection is actively
35monitored by pinging the foreign host at frequent intervals, and also
36monitors the network conditions from the local host to the foreign
37host such as the mean round trip time and packet loss in this fashion.
38
39@section Sequencing Sequencing
40   
41Rather than a single byte stream that complicates the delineation of
42packets, ENet presents connections as multiple, properly sequenced
43packet streams that simplify the transfer of various types of data.
44
45ENet provides sequencing for all packets by assigning to each sent
46packet a sequence number that is incremented as packets are sent. ENet
47guarentees that no packet with a higher sequence number will be
48delivered before a packet with a lower sequence number, thus ensuring
49packets are delivered exactly in the order they are sent.
50
51For unreliable packets, ENet will simply discard the lower sequence
52number packet if a packet with a higher sequence number has already
53been delivered. This allows the packets to be dispatched immediately
54as they arrive, and reduce latency of unreliable packets to an
55absolute minimum.  For reliable packets, if a higher sequence number
56packet arrives, but the preceding packets in the sequence have not yet
57arrived, ENet will stall delivery of the higher sequence number
58packets until its predecessors have arrived.
59
60@section Channels Channels
61
62Since ENet will stall delivery of reliable packets to ensure proper
63sequencing, and consequently any packets of higher sequence number
64whether reliable or unreliable, in the event the reliable packet's
65predecessors have not yet arrived, this can introduce latency into the
66delivery of other packets which may not need to be as strictly ordered
67with respect to the packet that stalled their delivery.
68
69To combat this latency and reduce the ordering restrictions on
70packets, ENet provides multiple channels of communication over a given
71connection.  Each channel is independently sequenced, and so the
72delivery status of a packet in one channel will not stall the delivery
73of other packets in another channel.
74
75@section Reliability Reliability
76
77ENet provides optional reliability of packet delivery by ensuring the
78foreign host acknowledges receipt of all reliable packets. ENet will
79attempt to resend the packet up to a reasonable amount of times, if no
80acknowledgement of the packet's receipt happens within a specified
81timeout. Retry timeouts are progressive and become more lenient with
82every failed attempt to allow for temporary turbulence in network
83conditions.
84
85@section FaR Fragmentation and Reassembly
86
87ENet will send and deliver packets regardless of size. Large packets
88are fragmented into many smaller packets of suitable size, and
89reassembled on the foreign host to recover the original packet for
90delivery. The process is entirely transparent to the developer.
91
92@section Aggregation Aggregation
93
94ENet aggregates all protocol commands, including acknowledgements and
95packet transfer, into larger protocol packets to ensure the proper
96utilization of the connection and to limit the opportunities for
97packet loss that might otherwise result in further delivery latency.
98
99@section Adaptability Adaptability
100
101ENet provides an in-flight data window for reliable packets to ensure
102connections are not overwhelmed by volumes of packets. It also
103provides a static bandwidth allocation mechanism to ensure the total
104volume of packets sent and received to a host don't exceed the host's
105capabilities. Further, ENet also provides a dynamic throttle that
106responds to deviations from normal network connections to rectify
107various types of network congestion by further limiting the volume of
108packets sent.
109
110@section Portability Portability
111   
112ENet works on Windows and any other Unix or Unix-like platform
113providing a BSD sockets interface. The library has a small and stable
114code base that can easily be extended to support other platforms and
115integrates easily.  ENet makes no assumptions about the underlying
116platform's endianess or word size.
117
118@section Freedom Freedom
119
120ENet demands no royalties and doesn't carry a viral license that would
121restrict you in how you might use it in your programs. ENet is
122licensed under a short-and-sweet MIT-style license, which gives you
123the freedom to do anything you want with it (well, almost anything).
124
125*/
126
Note: See TracBrowser for help on using the repository browser.