verinec.adaptation.snmp.tftpserver
Class Upload
java.lang.Object
verinec.adaptation.snmp.tftpserver.Upload
public class Upload
- extends Object
Class responsible for uploading a data to our TFTP server directory.
We are the server, so this handles receiving a file from a client.
Most of the source was taken from
www.it.rit.edu/~netsyslb/vksf522/class_examples/Day09_TFTPServer/Upload.pdf
I removed the gui part.
- Version:
- 1.0
- Author:
- christoph.ehret at unifr.ch
|
Nested Class Summary |
private class |
Upload.Listener
Private class Listener that listens a socket
todo: what is the difference to TFTPServer and Download Listener? |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fp
private String fp
logger
private Logger logger
state
private int state
- state of the upload.
UPLOADING
private static final int UPLOADING
- See Also:
- Constant Field Values
ENDINGUL
private static final int ENDINGUL
- See Also:
- Constant Field Values
dgram
private DatagramPacket dgram
tftp
private TFTPPacket tftp
localDirName
private String localDirName
localName
private String localName
clientAddress
private InetAddress clientAddress
clientPort
private int clientPort
fostream
private DataOutputStream fostream
nextBlockNo
private int nextBlockNo
timer
private Timer timer
timerCount
private int timerCount
lastPacket
private DatagramPacket lastPacket
lastPacketDesc
private String lastPacketDesc
socket
private DatagramSocket socket
listener
private Upload.Listener listener
timerExpired
ActionListener timerExpired
Upload
public Upload(DatagramPacket pkt,
TFTPPacket tftp,
String localDirName)
- Creates an
Upload instance
- Parameters:
pkt - Unparsed datagram packettftp - TFTP packetlocalDirName - Name of the upload directory- See Also:
TFTPPacket
sendACK
private void sendACK()
sendError
private void sendError(int code)
sendPacket
private void sendPacket(DatagramPacket pkt)
throws IOException
- Throws:
IOException
processPacket
private void processPacket(DatagramPacket pkt)
doWRQ
public void doWRQ()
- Processes a Write Request at the beginning of an upload
doDATA
private void doDATA(TFTPPacket pkt)
doERROR
private void doERROR(TFTPPacket pkt)
endUpload
private void endUpload()