[ENet-discuss] ordered packets
Tibor Klajnscek
tibor.klajnscek at gmail.com
Fri Mar 31 09:08:01 PST 2006
Why don't you guys just use ENET_PACKET_FLAG_UNSEQUENCED for unordered
packet delivery
without using so many channels? Just wondering if i'm doing something
wrong :)
Luis Cabellos wrote:
>Well, in the server I don't discriminate among the channel that the
>packet came from. So in the server I treat all packets the same way.
>Enet use the channels to mantain the order of packets. All the packets
>in the same channel are in-order, and if one of the packets arrive at
>server too later, it will be dropping and wait for acknowledgment.So if
>you know that the packets don't need the order, the use of a range of
>channels
>
>Let me show one ASCII example :)
>
> When you use on channel
> Send:
> 1 2 3 4 5 6 7 8 9 10 11 12 -> channel 1
>
> Receive:
> 1 2 [>> 4 5 3 <<] 6 7 8 9 10 11 12 ->channel 1
> -> Enet drop 4 and wait for arrive of 3
>
> And when you use 3 channels, [ min = 1 , max = 3 ]
> Send:
> 1 4 7 10 -> channel 1
> 2 5 8 11 -> channel 2
> 3 6 9 12 -> channel 3
>
> Receive
> 1 4 7 10 -> channel 1
> 2 5 8 11 -> channel 2
> 3 6 9 12 -> channel 3
> -> And you get 1 2 4 5 3 6 7 8 9 10 11 12 without drop / wait
>
>So the client is the only that change the lenght of the range of
>channels, with a long range less probability of out-of-order. And the
>change of the number of channels if you maintain that ( min <= max ) it
>will be always one channel at least. In the other hand, if you increase
>the range, I think that the server will not slow down too much with the
>use of more channels.
>
>- Luis | Tragnarion
>
>Paul Collier wrote:
>
>
>
>>I'm curious about setting the range of channels. Is there any way to
>>set it other than by the client at connection establishment? If
>>someone tried to clone a program's protocol with enet but changed the
>>number of channels, could this possibly affect the behaviour of the
>>server you were running? (i.e. they set it to zero--could this break
>>the server network code? Or perhaps they set it to a very high
>>number--could this slow down the server?) Enet seems to be pretty good
>>about security from what I've seen, in any case.
>>
>>- Paul
>>
>>On 3/30/06, Luis Cabellos <lists at tragnarion.com> wrote:
>>
>>
>>
>>
>>>You can send Unordered packets using a range of channels and send the
>>>packets sequentially in those channels. e.g: If you reserve [min, max] for
>>>unordered send, the next code snip will work like an unordered send.
>>>
>>> packet = enet_packet_create( msg, size, ENET_PACKET_FLAG_RELIABLE );
>>> enet_peer_send( server, unorderedChannel, packet);
>>> ++this->unorderedChannel;
>>> if( unorderedChannel > MAX_UNORDERED ) {
>>> unorderedChannel = MIN_UNORDERED;
>>> }
>>>
>>>Luis | Tragnarion
>>>
>>>
>>>
>
>_______________________________________________
>ENet-discuss mailing list
>ENet-discuss at cubik.org
>http://lists.cubik.org/mailman/listinfo/enet-discuss
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cubik.org/pipermail/enet-discuss/attachments/20060331/8903a1a9/attachment.htm
More information about the ENet-discuss
mailing list