udt
Class UDTSender

java.lang.Object
  extended by udt.UDTSender

public class UDTSender
extends Object

sender part of a UDT entity

See Also:
UDTReceiver

Constructor Summary
UDTSender(UDTSession session, UDPEndPoint endpoint)
           
 
Method Summary
 long getCurrentSequenceNumber()
           
 long getLargestSentSequenceNumber()
          returns the largest sequence number sent so far
 long getLastAckSequenceNumber()
          returns the last Ack.
 long getNextSequenceNumber()
          the next sequence number for data packets.
protected  void handleResubmit(Long seqNumber)
          re-submits an entry from the sender loss list
protected  void onAcknowledge(Acknowledgement acknowledgement)
           
protected  void onNAKPacketReceived(NegativeAcknowledgement nak)
          procedure when a NAK is received (spec.
 void pause()
           
protected  void putUnacknowledgedPacketsIntoLossList()
          for processing EXP event (see spec.
protected  void receive(UDTPacket p)
           
protected  void sendAck2(long ackSequenceNumber)
           
 void senderAlgorithm()
           
protected  void sendKeepAlive()
           
protected  boolean sendUdtPacket(DataPacket p, int timeout, TimeUnit units)
          writes a data packet into the sendQueue, waiting at most for the specified time if this is not possible due to a full send queue
 void start()
          start the sender thread
 void stop()
           
 void waitForAck()
          wait for the next acknowledge
 void waitForAck(long sequenceNumber)
          wait until the given sequence number has been acknowledged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UDTSender

public UDTSender(UDTSession session,
                 UDPEndPoint endpoint)
Method Detail

start

public void start()
start the sender thread


sendUdtPacket

protected boolean sendUdtPacket(DataPacket p,
                                int timeout,
                                TimeUnit units)
                         throws IOException,
                                InterruptedException
writes a data packet into the sendQueue, waiting at most for the specified time if this is not possible due to a full send queue

Parameters:
p -
timeout -
units -
Returns:
trueif the packet was added, false if the packet could not be added because the queue was full
Throws:
IOException
InterruptedException

receive

protected void receive(UDTPacket p)
                throws IOException
Throws:
IOException

onAcknowledge

protected void onAcknowledge(Acknowledgement acknowledgement)
                      throws IOException
Throws:
IOException

onNAKPacketReceived

protected void onNAKPacketReceived(NegativeAcknowledgement nak)
procedure when a NAK is received (spec. p 14)

Parameters:
nak -

sendKeepAlive

protected void sendKeepAlive()
                      throws Exception
Throws:
Exception

sendAck2

protected void sendAck2(long ackSequenceNumber)
                 throws IOException
Throws:
IOException

senderAlgorithm

public void senderAlgorithm()
                     throws InterruptedException,
                            IOException
Throws:
InterruptedException
IOException

handleResubmit

protected void handleResubmit(Long seqNumber)
re-submits an entry from the sender loss list

Parameters:
entry -

putUnacknowledgedPacketsIntoLossList

protected void putUnacknowledgedPacketsIntoLossList()
for processing EXP event (see spec. p 13)


getNextSequenceNumber

public long getNextSequenceNumber()
the next sequence number for data packets. The initial sequence number is "0"


getCurrentSequenceNumber

public long getCurrentSequenceNumber()

getLargestSentSequenceNumber

public long getLargestSentSequenceNumber()
returns the largest sequence number sent so far


getLastAckSequenceNumber

public long getLastAckSequenceNumber()
returns the last Ack. sequence number


waitForAck

public void waitForAck(long sequenceNumber)
                throws InterruptedException
wait until the given sequence number has been acknowledged

Throws:
InterruptedException

waitForAck

public void waitForAck()
                throws InterruptedException
wait for the next acknowledge

Throws:
InterruptedException

stop

public void stop()

pause

public void pause()


Copyright © 2013 LittleShoot. All Rights Reserved.