// Definitions for a simple UDP file transfer server. // The protocol is modelled on the Trivial File Transfer // Protocol (TFTP) described in RFC 1350. // Only sending of a file is implemented, and the // transfer mode is binary (i.e. octet). public interface UDPFileTransfer { // The (arbitrary) port of the file transfer service. public static final int ServerPort = 20069; // Opcode numbers. public static final int RRQ = 1, DATA = 3, ACK = 4, ERROR = 5; // Error values. public static final int FileNotFound = 1, AccessViolation = 2, IllegalOperation = 4, UnknownPort = 5; // The size (in bytes) of the Opcode and block number. public static int opcodeSize = 2, blockNumberSize = 2; // The maximum size of any data that may be transferred. public static int MaxDataPacket = 512; // Define the length of a DATA header. public static int dataHeaderLength = opcodeSize+blockNumberSize; // Define the length of a full data packet. public static int fullDataPacket = dataHeaderLength+MaxDataPacket; }