public AckOperating() { packetIdCounter = new UDPClientServerCommons.Usefull.PacketIdCounter(1); packetsWaitingForAck = new Dictionary<ushort, Interfaces.IPacket>(); TimerCallback callBack = new TimerCallback(TimerCallbackEvent); AckTimer = new Timer(callBack, null, System.Threading.Timeout.Infinite, 2*_SENDING_DELAY); }
public MessagePacket(byte[] binaryMessagePacket) { messageField = string.Empty; int pos = 2; this.packetIdCounterField = new UDPClientServerCommons.Usefull.PacketIdCounter(BitConverter.ToUInt16(binaryMessagePacket, pos)); pos += 2; this.timestampField = DateTime.FromBinary(BitConverter.ToInt64(binaryMessagePacket, pos)); pos += 8; int stringLength = (int)BitConverter.ToUInt16(binaryMessagePacket, pos); pos += 2; this.messageField = Encoding.UTF8.GetString(binaryMessagePacket, pos, stringLength); }
public ServerSide(int port) : base(port) { if (MyIp != null) ServerIpAdress = new IPEndPoint(MyIp,port); base.MessageWasReceivedEvent += new EventHandler(myUdpServer_MessageWasReceivedEvent); System.Threading.TimerCallback timerCallback = new System.Threading.TimerCallback(timerCallbackMethod); timer = new System.Threading.Timer(timerCallback, null, System.Threading.Timeout.Infinite,_TimerTickPeriod ); // ackOperating = new AckOperating(); //diagnostics Diagnostic.NetworkingDiagnostics.Configure(); //counter packetIdCounter = new UDPClientServerCommons.Usefull.PacketIdCounter(); }