Skip to content

libvncclient: add FileTransfer client support#719

Open
marcofortina wants to merge 2 commits into
LibVNC:masterfrom
marcofortina:feature/libvncclient-filetransfer-callbacks
Open

libvncclient: add FileTransfer client support#719
marcofortina wants to merge 2 commits into
LibVNC:masterfrom
marcofortina:feature/libvncclient-filetransfer-callbacks

Conversation

@marcofortina
Copy link
Copy Markdown
Contributor

@marcofortina marcofortina commented May 16, 2026

Summary

Adds initial LibVNCClient support for the legacy UltraVNC/TightVNC-1.3.x rfbFileTransfer message path and provides a working client-side example.

Changes

  • Add a HandleFileTransfer callback to rfbClient.
  • Add FileTransferSend() for sending legacy rfbFileTransfer messages from LibVNCClient applications.
  • Parse incoming legacy rfbFileTransfer messages and dispatch them to the callback.
  • Consume the legacy file-download header high-size field so subsequent file-transfer messages remain aligned.
  • Add examples/client/filetransfer.c with:
    • file-transfer access request
    • remote directory listing
    • remote file download
  • Build the new client example when examples are enabled.
  • Add regression tests for the callback and send helper.

Validation

General build and tests:

cmake -S . -B build-83-patch \
  -DWITH_EXAMPLES=ON \
  -DWITH_TESTS=ON \
  -DWITH_OPENSSL=OFF \
  -DWITH_GNUTLS=OFF \
  -DWITH_GCRYPT=OFF \
  -DWITH_SDL=OFF \
  -DWITH_GTK=OFF \
  -DWITH_QT=OFF \
  -DWITH_FFMPEG=OFF \
  -DWITH_XCB=OFF \
  -DWITH_LIBSSHTUNNEL=OFF \
  -DWITH_SYSTEMD=OFF \
  -DCMAKE_BUILD_TYPE=Debug
cmake --build build-83-patch --parallel 1
ctest --test-dir build-83-patch --output-on-failure

Result:

100% tests passed, 0 tests failed out of 6

Runtime smoke against the existing server-side file-transfer example:

mkdir -p /tmp/libvnc-ft-smoke
printf 'hello file transfer\n' > /tmp/libvnc-ft-smoke/source.txt

./build-83-patch/examples/server/filetransfer \
  -rfbport 5997 \
  -rfbportv6 5998 \
  -permitfiletransfer

./build-83-patch/examples/client/filetransfer \
  -ft-download C:/tmp/libvnc-ft-smoke/source.txt \
  /tmp/libvnc-ft-smoke/downloaded.txt \
  127.0.0.1:97

cmp /tmp/libvnc-ft-smoke/source.txt /tmp/libvnc-ft-smoke/downloaded.txt

./build-83-patch/examples/client/filetransfer \
  -ft-list C:/tmp/libvnc-ft-smoke \
  127.0.0.1:97

Observed:

Downloaded 20/20 bytes to /tmp/libvnc-ft-smoke/downloaded.txt
Directory: C:/tmp/libvnc-ft-smoke
  ..
  source.txt
  downloaded.txt

FileTransfer client smoke

Validated against examples/server/filetransfer with legacy TightVNC file transfer enabled:

  • server: examples/server/filetransfer -permitfiletransfer
  • client: examples/client/filetransfer
  • downloaded C:/tmp/libvnc-ft-smoke/source.txt to /tmp/libvnc-ft-smoke/downloaded.txt
  • verified downloaded content with cmp
  • listed C:/tmp/libvnc-ft-smoke and saw source.txt/downloaded.txt

Result: PASS.

Notes

This PR implements the legacy rfbFileTransfer client-side path. TightVNC-2.x file transfer uses a separate protocol extension and remains out of scope for this PR.

Closes #83.

@Neustradamus
Copy link
Copy Markdown

Good job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

file transfer support in libvncclient

3 participants