Example usage for org.apache.commons.net.tftp TFTP OCTET_MODE

List of usage examples for org.apache.commons.net.tftp TFTP OCTET_MODE

Introduction

In this page you can find the example usage for org.apache.commons.net.tftp TFTP OCTET_MODE.

Prototype

int OCTET_MODE

To view the source code for org.apache.commons.net.tftp TFTP OCTET_MODE.

Click Source Link

Document

The octet transfer mode.

Usage

From source file:jsaf.protocol.tftp.TftpURLConnection.java

public void run() {
    try {//  w w  w . jav a2 s .  c  o m
        if (0 == client.receiveFile(url.getPath(), TFTP.OCTET_MODE, out, host, port)) {
            logger.warn(Message.ERROR_TFTP, url.getPath());
        }
    } catch (IOException e) {
        logger.warn(Message.getMessage(Message.ERROR_EXCEPTION), e);
    } finally {
        try {
            out.close();
        } catch (IOException e) {
            logger.warn(Message.getMessage(Message.ERROR_EXCEPTION), e);
        }
        connected = false;
    }
}

From source file:org.xerela.nio.nioagent.datagram.tftp.CommonsNetTest.java

private int receiveFile(OutputStream out) {
    String errorMsg = "Failed to receive file";
    try {//from  w  w w .ja va2s .  c om
        return client.receiveFile("foo", TFTP.OCTET_MODE, out, hostname);
    } catch (UnknownHostException e) {
        throw exceptionHandler.handle(errorMsg, e);
    } catch (IOException e) {
        throw exceptionHandler.handle(errorMsg, e);
    }
}

From source file:org.xerela.nio.nioagent.datagram.tftp.CommonsNetTest.java

private void sendFile(InputStream in) {
    String errorMsg = "Failed to send file";
    try {/*from   w  w  w. ja va  2s  . c o  m*/
        client.sendFile("bar", TFTP.OCTET_MODE, in, hostname);
    } catch (UnknownHostException e) {
        throw exceptionHandler.handle(errorMsg, e);
    } catch (IOException e) {
        throw exceptionHandler.handle(errorMsg, e);
    }
}