/// <summary> /// Returns this object back to the object pool from whence it came. /// </summary> public void Recycle() { this.Acknowledged = true; this.Connection = null; PacketPool.PutObject(this); }
/// <summary> /// Creates a new UdpConnectionListener for the given <see cref="IPAddress"/>, port and <see cref="IPMode"/>. /// </summary> /// <param name="endPoint">The endpoint to listen on.</param> public UdpConnectionListener(IPEndPoint endPoint, IPMode ipMode = IPMode.IPv4, Action <string> logger = null) { this.Logger = logger; this.EndPoint = endPoint; this.IPMode = ipMode; this.socket = UdpConnection.CreateSocket(this.IPMode); socket.ReceiveBufferSize = SendReceiveBufferSize; socket.SendBufferSize = SendReceiveBufferSize; reliablePacketTimer = new Timer(ManageReliablePackets, null, 100, Timeout.Infinite); }
internal void Set(ushort id, UdpConnection connection, byte[] data, int length, int timeout, Action ackCallback) { this.Id = id; this.Data = data; this.Connection = connection; this.Acknowledged = false; this.NextTimeout = timeout; this.AckCallback = ackCallback; this.Retransmissions = 0; this.Stopwatch.Restart(); }
/// <summary> /// Creates a new UdpConnectionListener for the given <see cref="IPAddress"/>, port and <see cref="IPMode"/>. /// </summary> /// <param name="endPoint">The endpoint to listen on.</param> public UdpConnectionListener(IPEndPoint endPoint, IPMode ipMode = IPMode.IPv4, ILogger logger = null) { this.Logger = logger; this.EndPoint = endPoint; this.IPMode = ipMode; this.socket = UdpConnection.CreateSocket(this.IPMode); socket.ReceiveBufferSize = SendReceiveBufferSize; socket.SendBufferSize = SendReceiveBufferSize; reliablePacketTimer = new Thread(ManageReliablePackets); reliablePacketTimer.Start(); }
internal Packet(UdpConnection connection) { this.Connection = connection; }