Exemplo n.º 1
0
 /// <summary>
 /// create a receiver with a valid {@link UDTSession}
 /// </summary>
 /// <param name="session"></param>
 /// <param name="endpoint"></param>
 public UDTReceiver(UDTSession session, UDPEndPoint endpoint)
 {
     this.roundTripTimeVar = roundTripTime / 2;
     this.endpoint         = endpoint;
     this.session          = session;
     //( System.DateTime.UtcNow.Ticks - new DateTime(1970, 1, 1, 0, 0, 0).Ticks)/10000;
     //如果要得到Java中 System.currentTimeMillis() 一样的结果,就可以写成 上面那样,也可以这样写:
     // TimeSpan ts=new TimeSpan( System.DateTime.UtcNow.Ticks - new DateTime(1970, 1, 1, 0, 0, 0).Ticks);
     //(long)ts.TotalMilliseconds;
     this.sessionUpSince = (long)ts.TotalMilliseconds;
     this.statistics     = session.getStatistics();
     if (!session.isReady())
     {
         Log.Write(this.ToString(), "UDTSession is not ready.");
     }
     ackHistoryWindow         = new AckHistoryWindow(16);
     packetHistoryWindow      = new PacketHistoryWindow(16);
     receiverLossList         = new ReceiverLossList();
     packetPairWindow         = new PacketPairWindow(16);
     largestReceivedSeqNumber = (int)session.getInitialSequenceNumber() - 1;
     bufferSize      = session.getReceiveBufferSize();
     handoffQueue    = new Queue <UDTPacket>(4 * session.getFlowWindowSize());
     storeStatistics = false;      //Boolean.getBoolean("udt.receiver.storeStatistics");
     initMetrics();
     start();
 }
Exemplo n.º 2
0
 /**
  * create a receiver with a valid {@link UDTSession}
  * @param session
  */
 public UDTReceiver(UDTSession session, UDPEndPoint endpoint)
 {
     this.endpoint       = endpoint;
     this.session        = session;
     this.sessionUpSince = DateTime.Now.Ticks;
     this.statistics     = session.Statistics;
     if (!session.IsReady)
     {
         throw new IllegalStateException("UDTSession is not ready.");
     }
     ackHistoryWindow         = new AckHistoryWindow(16);
     packetHistoryWindow      = new PacketHistoryWindow(16);
     receiverLossList         = new ReceiverLossList();
     packetPairWindow         = new PacketPairWindow(16);
     largestReceivedSeqNumber = session.InitialSequenceNumber - 1;
     bufferSize   = session.ReceiveBufferSize;
     handoffQueue = new BlockingCollection <IUDTPacket>(4 * session.FlowWindowSize);
     //storeStatistics=bool.getbool("udt.receiver.storeStatistics");
     InitMetrics();
     Start();
 }