Ejemplo n.º 1
0
 internal NetConnection(bool isServer, bool isPeer, NetSocket socket, IPEndPoint endpoint, uint id = 0) {
     IsServer = isServer;
     IsPeer = isPeer;
     Socket = socket;
     Endpoint = endpoint;
     Id = id;
     Unreliable = new NetChannelUnreliable(this);
     Reliable = new NetChannelReliable(this);
     LastReceiveTime = LastSendTime = Created = NetTime.Milliseconds();
     AddToGroup(0);
 }
Ejemplo n.º 2
0
 internal static NetHeader Create(NetChannelReliable chan, uint time) {
     var header = new NetHeader {
         AckHistory = chan.AckHistory,
         AckSequence = chan.NewestRemoteSequence,
         ObjSequence = chan.LocalSequence,
         SendTime = time
     };
     if (chan.LastReceiveTime > time) {
         header.AckTime = (ushort)Mathf.Clamp(time - chan.LastReceiveTime, 0, 6000);
     }
     return header;
 }
Ejemplo n.º 3
0
 internal NetConnection(bool isServer, bool isPeer, NetSocket socket, IPEndPoint endpoint, uint id = 0)
 {
     IsServer        = isServer;
     IsPeer          = isPeer;
     Socket          = socket;
     Endpoint        = endpoint;
     Id              = id;
     Unreliable      = new NetChannelUnreliable(this);
     Reliable        = new NetChannelReliable(this);
     LastReceiveTime = LastSendTime = Created = NetTime.Milliseconds();
     AddToGroup(0);
 }
Ejemplo n.º 4
0
            internal static NetHeader Create(NetChannelReliable chan, uint time)
            {
                var header = new NetHeader {
                    AckHistory  = chan.AckHistory,
                    AckSequence = chan.NewestRemoteSequence,
                    ObjSequence = chan.LocalSequence,
                    SendTime    = time
                };

                if (chan.LastReceiveTime > time)
                {
                    header.AckTime = (ushort)Mathf.Clamp(time - chan.LastReceiveTime, 0, 6000);
                }
                return(header);
            }