• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Impero · Feb 09, 2017 at 07:18 PM · networkingsource codechannels

In HLAPI are the ChannelPacket in a reliable ChannelBuffer supposed to be delivered in sequence?

This question might be a bit on the technical side. I have been looking around the source code of the Unity networking HLAPI and I noticed something that confuses me.

If a ChannelBuffer is considered reliable, it uses a Queue to store pending ChannelPackets. These packets are then sent in FIFO order to the NetworkTransport whenever SendInternalBuffer() is called - typically at the end of each frame. That's unless there's room for them to be sent immediately.

I was under the assumption that the use of a Queue structure, was in order to have the packets sent in the sequence they're passed to the ChannelBuffer, but then I noticed the following piece of code in the SendInternalBuffer() method:

 var packet = m_PendingPackets.Dequeue();
 if (!packet.SendToTransport(m_Connection, m_ChannelId))
 {
     m_PendingPackets.Enqueue(packet);
     break;
 }

This code is part of the loop that sends the pending packets to the NetworkTransport. It removes a packet from the beginning of the queue and attempts to send it, if it fails, it add's the packet at the end of the queue. Unless the queue is empty, this enqueue action, messes with the order of the packets, thus breaking my assumption (and breaking the point of having a queue in the first place, I guess).

So my question: Are messages/packets, sent using a reliable Channel, supposed to be sent in sequence?

If this is the case, calling enqueue in the above snippet is a bug.

NOTE: I'm not considering whether the channel is ReliableSequenced or just Reliable, since the ChannelBuffer doesn't have a notion of the specific QOS. It only cares about whether it's reliable or not.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity networking tutorial? 6 Answers

Why does ReliableFragmentedSequenced have a 32 fragment limit? 0 Answers

UNET Setting up a new channel and subsequently message fragmentation 2 Answers

How do you send data from Android to PC? 0 Answers

Multiplayer Networking Problems 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges