public class ClientDownloadPartUDP extends ClientDownloadPart
Modifier and Type | Field and Description |
---|---|
private java.net.DatagramSocket |
socket |
client, failed, filename, logger, manager, MAX_PARTIAL_SIZE, noTask, partsSubdir, pendingTasks, receivedBytesCount, stop, tasksDone, tasksListsLock, toDoTasks
Constructor and Description |
---|
ClientDownloadPartUDP(ClientDownload manager,
java.lang.String filename,
java.net.DatagramSocket socket,
java.lang.String partsSubdir,
Logger logger,
HostItem client,
HostItem server)
Constructor with filename, socket, and part subdir
|
Modifier and Type | Method and Description |
---|---|
protected void |
closeSocket()
Close the socket
|
protected <T extends Payload> |
createProtocolP2PPacket(T payload)
Create packets
|
protected java.lang.Object |
getSocket()
Get the socket
|
protected void |
writeLog(java.lang.Exception e,
LogLevel logLevel)
Implementation of writeLog
|
protected void |
writeLog(java.lang.String text,
LogLevel logLevel)
Implementation of writeLog
|
assignTask, doTasks, downloadPart, getDone, getFailed, getReceivedBytesCount, getServer, hasFailed, reqPart, run, setStop
sendEmptyDirectory, sendEmptyFile, sendInternalError, sendNotATracker, sendNotFound, sendUnknownHost
public ClientDownloadPartUDP(ClientDownload manager, java.lang.String filename, java.net.DatagramSocket socket, java.lang.String partsSubdir, Logger logger, HostItem client, HostItem server)
filename
- name of file to downloadsocket
- socket to usepartsSubdir
- directory to store .part fileslogger
- Loggerclient
- HostItem of the applicationserver
- HostItem of the server applicationprotected java.lang.Object getSocket()
getSocket
in class ClientDownloadPart
protected void closeSocket() throws java.io.IOException
closeSocket
in class ClientDownloadPart
java.io.IOException
protected void writeLog(java.lang.String text, LogLevel logLevel)
writeLog
in class ServeErrors
text
- Text to loglogLevel
- level of loggingprotected void writeLog(java.lang.Exception e, LogLevel logLevel)
writeLog
in class ServeErrors
e
- exception to loglogLevel
- level of loggingprotected <T extends Payload> ProtocolP2PPacket<T> createProtocolP2PPacket(T payload)
createProtocolP2PPacket
in class ServeErrors
payload
- Payload