Network Requirements
Scrcpy for Android requires network connectivity between the controlling device and the target device. Understanding the network architecture helps optimize performance and troubleshoot connection issues.Local Network Configuration
For most use cases, both devices should be on the same local network.Prerequisites
Enable ADB over Network
On the target device (the one to be controlled), enable ADB debugging over TCP/IP:This tells the device to listen for ADB connections on port 5555.
Find Device IP Address
Get the target device’s local IP address:
- Go to Settings → About Phone → Status → IP Address
- Or use:
adb shell ip addr show wlan0
192.168.1.100Network Ports Used
Scrcpy for Android uses the following ports during operation:
| Port | Direction | Purpose | Configurable |
|---|---|---|---|
| 5555 | Client → Target | ADB connection | Yes (via ADB) |
| 7007 | Local only | Server socket on target device | No |
| 7008 | Local only | Forwarded port on client device | Defined in Scrcpy.java:36 |
Port Forwarding Flow
The connection uses ADB’s port forwarding mechanism: The forwarding is established inSendCommands.java:109:
Public Network Access Setup
To access a device over the internet or different networks, additional configuration is required.Method 1: Router Port Forwarding
If the target device is behind a router:Set Static IP
Configure the target device with a static IP on your local network (e.g.,
192.168.1.100).Configure Router
Log into your router’s admin panel and add a port forwarding rule:
- External Port:
5555 - Internal IP:
192.168.1.100 - Internal Port:
5555 - Protocol:
TCP
Method 2: VPN Tunnel
A more secure approach using a VPN:WireGuard
Set up a WireGuard VPN server on your network. Both devices join the VPN and communicate via private IPs.Pros: Encrypted, secure, NAT traversal
Tailscale/ZeroTier
Use a mesh VPN service for easy peer-to-peer connections without manual configuration.Pros: No port forwarding needed, cross-platform
Method 3: Reverse SSH Tunnel
If you have access to a public server:Firewall Configuration
Target Device Firewall
Android doesn’t typically have a firewall by default, but if using custom ROMs or security apps:Allow ADB port 5555
Allow ADB port 5555
Ensure TCP port 5555 is allowed for incoming connections from your local network or VPN subnet.
Allow local server socket
Allow local server socket
Port 7007 only needs to accept local connections (from the ADB daemon), not external traffic.
Client Device Firewall
The client device initiates connections, so typically no inbound rules are needed. However:- Allow outbound TCP to port 5555 on target device
- Allow local binding to port 7008 (ADB forward)
Router/Network Firewall
If devices are on different subnets within the same network:- Allow TCP port 5555 between subnets
- Consider using VLANs for security isolation
- Implement access control lists (ACLs) if needed
Network Performance Tuning
Bandwidth Requirements
The application’s bandwidth usage depends on your configuration:| Resolution | Bitrate | Estimated Bandwidth |
|---|---|---|
| 1080p | 2 Mbps | ~2-3 Mbps total |
| 1080p | 4 Mbps | ~4-5 Mbps total |
| 1440p | 8 Mbps | ~8-10 Mbps total |
Bandwidth includes video (H.264), audio (AAC at 128kbps), and control data. The bitrate is configurable in the app UI.
Optimizing for Different Networks
- Local Wi-Fi (Optimal)
- Mobile Data / 4G
- Public Network / VPN
Configuration:
- Bitrate: 4-8 Mbps
- Resolution: Native or 1080p
- Delay tolerance: 50ms
- Use 5GHz Wi-Fi for better bandwidth and lower latency
- Ensure both devices have strong signal strength
- Disable Wi-Fi power saving on both devices
Delay Control
The application includes delay tolerance settings to handle network latency (Scrcpy.java:342-469):
- Purpose: Drops frames that arrive too late to maintain sync
- Configuration: Available in app settings (50ms, 100ms, 200ms, etc.)
- Algorithm:
Higher delay tolerance = smoother playback but increased latency. Lower values = more responsive but may stutter on slow networks.
Connection Stability
The client implements automatic retry logic (Scrcpy.java:238-340):
- Initial connection: 50 attempts with 100ms intervals (5 seconds total)
- Handshake timeout: 10 attempts × 100ms = 1 second
- Auto-reconnect: Available in headless mode
- Reduce packet size: Lower resolution and bitrate
- Enable QoS: Configure router Quality of Service for ADB traffic
- Use wired connection: If possible, connect target device via USB tethering or Ethernet adapter
Troubleshooting Network Issues
Connection Timed Out
Connection Timed Out
Symptoms: “Connection Timed out” error after startingSolutions:
- Verify target device IP address is correct
- Check both devices are on same network (or VPN)
- Ensure port 5555 is not blocked by firewall
- Restart ADB on target:
adb kill-server && adb tcpip 5555 - Check target device has not gone to sleep (disable battery optimization)
Laggy or Stuttering Video
Laggy or Stuttering Video
Symptoms: High latency, frame drops, stutteringSolutions:
- Lower bitrate setting in app
- Reduce resolution
- Increase delay tolerance
- Move closer to Wi-Fi router
- Check for network congestion (other devices using bandwidth)
- Use 5GHz Wi-Fi instead of 2.4GHz
Disconnects Frequently
Disconnects Frequently
Symptoms: Connection drops after a few minutesSolutions:
- Disable battery optimization for ADB and Scrcpy app
- Keep target device screen on during mirroring
- Check for Wi-Fi sleep settings
- Ensure stable network (weak signal causes drops)
- Enable “Keep Wi-Fi on during sleep” on both devices
Cannot Connect Over Internet
Cannot Connect Over Internet
Symptoms: Works on local network but not remotelySolutions:
- Verify port forwarding is correctly configured
- Check router firewall allows port 5555
- Test using public IP (not local 192.168.x.x)
- Consider using VPN instead of port forwarding
- Check ISP doesn’t block incoming connections (use DMZ as test)
Security Considerations
Best Practices
- Use VPN: Always use VPN for remote access instead of exposing port 5555
- Disable when not in use: Turn off ADB network listening when not needed
- Whitelist IPs: Use firewall rules to allow only specific client IPs
- Monitor connections: Check
adb devicesto see what’s connected - Use authentication: Consider ADB key-based authentication (requires initial USB pairing)
