edu.virginia.cs.mng.hypercast.demo
Class MFTP

java.lang.Object
  |
  +--edu.virginia.cs.mng.hypercast.demo.MFTP

class MFTP
extends java.lang.Object
implements I_CallBack

This is a multicast ftp application class. The paradigm is that all MFTP applications have a "common" directory. All files that are multicast are placed relative to that "common" directory. The sender usually sends a file that is not currently in the "common" directory. A simple application protocol is used in mftp when sending a file: 1. Sends FILE_START message (includes file length and file name.) The receiver creates a temp file and stores the length of the file. 2. Sender sends FILE_DATA (unique ID is used to identify the file.) The receiver writes the blocks to the file. On the last block, the temporary file is moved to the correct file. NB: We use FILE_START rather than FILE_END to transfer the description of the file so that receivers can know what they're receiving and possibly put a little "time to completion" bar on the display. Message formats: FILE_ID = {uniqueID of sender + file number} TYPE(byte) = {FILE_START = 1, FILE_DATA = 2, FILE_END = 3,ACK = 4, DIR_START = 5} FILE_START FILELENGTH(long) FILENAME(byte[]) ASCII FILE_DATA: INDEX(long) of first byte of message relative to file start. DATA[](byte[]) FILE_END: ACK: FILELENGTH(long) CURRENTTIME(long) FILENAME(byte[]) ASCII I_LOGICALADDRESS DIR_START: DIRECTORYNAME(byte[]) ASCII


Field Summary
(package private)  java.util.Vector ackStore
           
(package private)  I_MFTPCallBack callBack
           
(package private)  MFTP_Rev_FileEntry fe
           
(package private)  int fileCounter
           
private  java.lang.Object fileCounterLock
           
(package private)  java.lang.String ftpDir
           
(package private)  I_OverlaySocket mySocket
           
private  java.util.Hashtable RevFileEntries
           
(package private)  MFTP_Send_FileEntry sfe
           
(package private)  byte[] uniqueID
           
 
Constructor Summary
(package private) MFTP(I_MFTPCallBack cb)
           
 
Method Summary
 void close()
           
private static java.net.InetAddress createInetAddress(byte[] byteAddress)
           
 void messageArrived(I_OverlayMessage msg)
           
 void sendAck(long fileLength, long time, java.lang.String filename, I_LogicalAddress srcLA)
           
 void sendDirectoryStart(java.lang.String dir)
           
 void sendFile(java.lang.String fileName, java.lang.String d)
           
 void setdir(java.lang.String dirname)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

mySocket

I_OverlaySocket mySocket

ftpDir

java.lang.String ftpDir

fileCounter

int fileCounter

uniqueID

byte[] uniqueID

RevFileEntries

private java.util.Hashtable RevFileEntries

fe

MFTP_Rev_FileEntry fe

sfe

MFTP_Send_FileEntry sfe

callBack

I_MFTPCallBack callBack

fileCounterLock

private java.lang.Object fileCounterLock

ackStore

java.util.Vector ackStore
Constructor Detail

MFTP

MFTP(I_MFTPCallBack cb)
Method Detail

close

public void close()

sendFile

public void sendFile(java.lang.String fileName,
                     java.lang.String d)

sendDirectoryStart

public void sendDirectoryStart(java.lang.String dir)

messageArrived

public void messageArrived(I_OverlayMessage msg)
Specified by:
messageArrived in interface I_CallBack

sendAck

public void sendAck(long fileLength,
                    long time,
                    java.lang.String filename,
                    I_LogicalAddress srcLA)

createInetAddress

private static java.net.InetAddress createInetAddress(byte[] byteAddress)

setdir

public void setdir(java.lang.String dirname)