Skip to content
RETR/STOR Transfers
step 1/5

Reading — step 1 of 5

Read

~1 min readFiles & Directories

RETR/STOR Transfers

Retrieve a file (download):

C: TYPE I
S: 200
C: PASV
S: 227 Entering Passive Mode (..,p1,p2)
C: RETR /file.txt
S: 150 Opening data connection
[data connection: server sends bytes]
S: 226 Transfer complete

Store (upload):

C: TYPE I
S: 200
C: PASV
S: 227 ...
C: STOR /upload.txt
S: 150 Opening data connection
[data connection: client sends bytes; closes when done]
S: 226 Transfer complete

Other transfer commands:

  • APPE: append to existing file.
  • STOU: store unique (server picks filename).
  • REST: restart at byte offset (resume after disconnect).
  • ABOR: abort current transfer.

Resume:

C: REST 1024
S: 350 Restarting at 1024
C: RETR file.txt
S: 150 ... (sends from offset 1024)

Useful for large files over flaky connections.

ABOR semantics:

  • Sent on control channel (URGENT TCP marker).
  • Server may close data connection mid-transfer.
  • Reply: 426 (data conn closed) + 226 (ABOR successful).

Concurrent transfers in single session: not supported. ABORT current first.

Throughput considerations:

  • Single TCP connection per transfer.
  • Pipelining via multiple connections (some modern clients open 4 parallel sessions for one file).
  • HTTPS with parallel ranges trivializes this; HTTP/2 multiplexes.

Resumable uploads (TUS protocol, S3 multipart): better-designed alternatives.

Logging: server logs each transfer (STOR/RETR + size + duration). Used for billing/auditing.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…