OpenMetaverse.Simulator.SendPacketUnqueued C# (CSharp) Method

SendPacketUnqueued() public method

Send a raw byte array payload as a packet
public SendPacketUnqueued ( byte payload, bool setSequence ) : void
payload byte The packet payload
setSequence bool Whether the second, third, and fourth bytes /// should be modified to the current stream sequence number
return void
        public void SendPacketUnqueued(byte[] payload, bool setSequence)
        {
            try
            {
                if (setSequence && payload.Length > 3)
                {
                    uint sequence = (uint)Interlocked.Increment(ref Sequence.seq);

                    payload[1] = (byte)(sequence >> 16);
                    payload[2] = (byte)(sequence >> 8);
                    payload[3] = (byte)(sequence % 256);
                }

                Stats.SentBytes += (ulong)payload.Length;
                ++Stats.SentPackets;

                UDPPacketBuffer buf = new UDPPacketBuffer(remoteEndPoint);
                Buffer.BlockCopy(payload, 0, buf.Data, 0, payload.Length);
                buf.DataLength = payload.Length;

                AsyncBeginSend(buf);
            }
            catch (SocketException)
            {
                Logger.Log("Tried to send a " + payload.Length +
                    " byte payload on a closed socket, shutting down " + this.ToString(),
                    Helpers.LogLevel.Info, Client);

                Network.DisconnectSim(this, false);
                return;
            }
            catch (Exception e)
            {
                Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e);
            }
        }

Same methods

Simulator::SendPacketUnqueued ( NetworkManager outgoingPacket ) : void