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); }
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; }
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); }