Skip to main content

Peer-to-Peer File Transfer

ErikrafT Drop’s core feature is direct peer-to-peer file transfer using WebRTC technology. This enables devices to communicate directly without routing files through central servers, providing both privacy and performance benefits.

WebRTC DataChannel Implementation

Connection Establishment

The P2P transfer system uses WebRTC DataChannels for direct communication:

Binary Data Transfer

Files are transferred as binary data for maximum efficiency:

Transfer Capabilities

Supported File Types

  • All File Types: No restrictions on file formats
  • Large Files: Limited only by browser memory and network constraints
  • Multiple Files: Simultaneous transfer of multiple files and folders
  • Directory Support: Complete directory structure preservation

Transfer Performance

  • Direct Connection: No server bandwidth consumption
  • Network Speed: Limited only by local network capabilities
  • Concurrent Transfers: Multiple simultaneous transfers supported
  • Resume Capability: Automatic retry for interrupted transfers

Security Features

End-to-End Encryption

Connection Authentication

  • Certificate Exchange: WebRTC handles certificate exchange automatically
  • Fingerprint Verification: Connection hashes for security validation
  • Perfect Forward Secrecy: Each session uses unique encryption keys

Transfer Process

1. Discovery Phase

Devices discover each other through:
  • Local Network: Automatic IP-based discovery
  • Device Pairing: Persistent connections using room secrets
  • Public Rooms: Temporary 5-character room codes

2. Connection Phase

3. Transfer Phase

  • Request/Accept: Transfer request and user confirmation
  • Metadata Exchange: File information transmission
  • Chunked Transfer: 64KB chunks for memory efficiency
  • Progress Tracking: Real-time progress updates

File Chunking System

Chunk Size Optimization

Memory Management

  • Streaming: Files processed in chunks to prevent memory overload
  • Buffer Control: Efficient buffer management for large files
  • iOS Optimization: Special handling for iOS memory limits

Network Optimization

Connection Reuse

Adaptive Performance

  • ICE Candidate Selection: Optimal network path selection
  • Connection Monitoring: Real-time connection quality assessment
  • Automatic Fallback: WebSocket fallback when WebRTC fails

Error Handling

Connection Recovery

Transfer Reliability

  • Automatic Retry: Failed chunks are automatically resent
  • Progress Preservation: Transfer progress is maintained during retries
  • Graceful Degradation: Fallback to WebSocket when necessary

Performance Metrics

Transfer Speed

  • Local Network: Typically 50-200+ MB/s on Gigabit networks
  • WiFi Networks: 10-50 MB/s depending on signal quality
  • Mobile Networks: 1-10 MB/s depending on connection quality

Latency

  • Connection Setup: 1-3 seconds for WebRTC establishment
  • Transfer Latency: Sub-millisecond for local networks
  • Response Time: Real-time progress updates

Browser Compatibility

WebRTC Support Detection

Supported Browsers

  • Chrome 23+: Full WebRTC support
  • Firefox 22+: Full WebRTC support
  • Safari 11+: WebRTC support with some limitations
  • Edge 79+: Full WebRTC support (Chromium-based)

Advanced Features

Connection Hashing

Multi-Room Support

  • Simultaneous Rooms: Single peer in multiple room types
  • Flexible Discovery: IP-based, secret-based, and public rooms
  • Dynamic Switching: Seamless switching between room types

Use Cases

Personal File Sharing

  • Document Transfer: Quick sharing between work and personal devices
  • Media Sharing: Photo and video sharing between devices
  • Backup: Simple backup between computers and mobile devices

Professional Use

  • Collaboration: File sharing during meetings
  • Development: Quick code and asset sharing
  • Presentations: Transfer presentation files between devices

Emergency Scenarios

  • No Internet: Works completely offline on local networks
  • Remote Areas: No dependency on cloud services
  • Privacy: No third-party access to transferred files
This P2P transfer system provides a robust, secure, and efficient method for direct file sharing between devices while maintaining user privacy and maximizing transfer speeds.