All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class AcmeNet.Assn1.ReliableNI
AcmeNet.Util.NetworkInterface
   |
   +----AcmeNet.Assn1.ReliableNI
  -  public class ReliableNI
  
-  extends NetworkInterface
  
A reliable network interface.
 Acts just like an AcmeNet.Util.NetworkInterface, except that sent packets are
 automatically acknowledged, and unacknowledged packets are retransmitted by their
 sender.  The result is that every packet will eventually reach its destination,
 unless a process or the network suffers a serious failure.
  
  -  
	MaxPacketLength
   -   The maximum allowable packet size that can be sent.
  
 -  
	TimeoutSeconds
   -   How long to wait before retransmitting an unacknowledged packet.
 
  
  -  
	ReliableNI()
   -   Creates a ReliableNI at any available NetAddress.
  
 -  
	ReliableNI(NetAddress)
   -   Creates a ReliableNI at a specified NetAddress.
 
  
  -  
	resendBytes(NetAddress, byte[], int)
   -   Resend a packet of data.
  
 -  
	run()
   -   Executed by a daemon thread.
  
 -  
	sendBytes(NetAddress, byte[])
   -   Send a packet of data.
 
  
MaxPacketLength
 public static final int MaxPacketLength
  -  The maximum allowable packet size that can be sent.
 
TimeoutSeconds
 public static final long TimeoutSeconds
  -  How long to wait before retransmitting an unacknowledged packet.  Retransmission
 should normally occur between TimeoutSeconds and 2*TimeoutSeconds of the time
 the packet was sent.
 
  
ReliableNI
 public ReliableNI()
  -  Creates a ReliableNI at any available NetAddress.
 
ReliableNI
 public ReliableNI(NetAddress requiredAddress) throws AddressUnavailableException
  -  Creates a ReliableNI at a specified NetAddress.
  
    -  Parameters:
    
 -  requiredAddress - the address at which to create the ReliableNI
    
 -  Throws: AddressUnavailableException
    
 -  the requested address was not available
  
 
 
 
  
sendBytes
 protected void sendBytes(NetAddress dest,
                          byte data[]) throws IOException
  -  Send a packet of data.  If there is no Acme process at the destination
 address, the packet will silently vanish into oblivion.  But if there is a
 process at the destination, the packet will eventually be delivered.
  
    -  Parameters:
    
 -  dest - the address to send the packet to
    
-  data - an array containing the data to be sent
    
  -  Throws: IOException
    
 -  some I/O error occured
    
 -  Throws: PacketTooLargeException
    
 -  the packet would have been larger than MaxPacketLength
    
 -  Overrides:
    
 -  sendBytes in class NetworkInterface
  
 
 
 
resendBytes
 protected void resendBytes(NetAddress dest,
                            byte data[],
                            int seqNum) throws IOException
  -  Resend a packet of data.  The reliable-networking software should automatically
 call this whenever a packet that was sent is not acknowledged.
  
    -  Parameters:
    
 -  dest - the address to send the packet to
    
-  data - an array containing the data to be sent
    
-  seqNum - the sequence number of the packet (must be the same sequence number the packet had the first time it was sent)
    
   -  Throws: IOException
    
 -  some I/O error occured
    
 -  Throws: PacketTooLargeException
    
 -  the packet would have been larger than MaxPacketLength
  
 
 
 
run
 public void run()
  -  Executed by a daemon thread.  Grabs arriving packets and causes them to be
 processed appropriately.
  
    -  Overrides:
    
 -  run in class NetworkInterface
  
 
 
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index