NAME
Mojo::TFTPd::Connection - A connection class for Mojo::TFTPd
SYNOPSIS
See Mojo::TFTPd
ATTRIBUTES
type
$str = $connection->type;
Type of connection rrq or wrq
blocksize
$int = $connection->blocksize;
The negotiated blocksize. Default is 512 Byte.
error
$str = $connection->error;
Useful to check inside "finish" in Mojo::TFTPd events to see if anything has gone wrong. Holds a string describing the error.
file
$str = $connection->file;
The filename the client requested to read or write.
filehandle
$fh = $connection->filehandle;
This must be set inside the rrq or wrq event or the connection will be dropped. Can be either Mojo::Asset or filehandle.
filesize
$int = $connection->filesize;
This must be set inside the rrq to report "tsize" option if client requested.
If set inside wrq limits maximum upload size. Set automatically on WRQ with "tsize" option.
Can be used inside finish for uploads to check if reported "tsize" and received data length match.
timeout
$num = $connection->timeout;
Retransmit/Inactive timeout.
lastop
$str = $connection->lastop;
Last operation.
mode
$str = $connection->mode;
Either "netascii", "octet" or empty string if unknown.
peerhost
$str = $connection->peerhost;
The IP address of the remote client.
peername
$bin = $connection->peername;
Packet address of the remote client.
retries
$int = $connection->retries;
Number of times "send_data", "send_ack" or "send_oack" can be retried before the connection is dropped. This value comes from "retries" in Mojo::TFTPd or set inside rrq or wrq events.
retransmit
$int = $connection->retransmit;
Number of times last operation ("send_data", "send_ack" or "send_oack") to be retransmitted on timeout before the connection is dropped. This value comes from "retransmit" in Mojo::TFTPd or set inside rrq or wrq events.
Retransmits are disabled if set to 0.
socket
$fh = $connection->socket;
The UDP handle to send data to.
rfc
$hash_ref = $connection->rfc;
Contains RFC 2347 options the client has provided.
METHODS
receive_ack
$bool = $connection->receive_ack($bytes);
This method is called when the client sends ACK to the server.
receive_data
$bool = $connection->receive_data($bytes);
This method is called when the client sends DATA to the server.
receive_error
$bool = $connection->receive_error($bytes);
This method is called when the client sends ERROR to the server.
send_ack
$bool = $connection->send_ack;
This method is called when the server sends ACK to the client.
send_data
$bool = $connection->send_data;
This method is called when the server sends DATA to the client.
send_error
$bool = $connection->send_error($key => $descr);
Used to report error to the client.
send_oack
$bool = $connection->send_oack;
Used to send RFC 2347 OACK to client
Supported options are
- RFC 2348 blksize
-
Report "blocksize".
- RFC 2349 timeout
-
Report "timeout".
- RFC 2349 tsize
-
Report "filesize" if set inside the rrq.
send_retransmit
$bool = $connection->send_retransmit;
Used to retransmit last packet to the client.