Error: No route to host (OS Error: No route to host, errno = 113)
Target: 10.83.12.71:5000
This means the mobile device cannot establish a connection to the backend server.
Your backend is currently configured to listen on 0.0.0.0:5000 (all network interfaces).
Windows:
ipconfigLook for your WiFi adapter's IPv4 address. Common patterns:
192.168.x.x(Home WiFi)10.x.x.x(Some networks)172.16.x.xto172.31.x.x(Private networks)
Current configured IP in mobile app: 10.83.12.71
netstat -an | findstr :5000You should see:
TCP 0.0.0.0:5000 0.0.0.0:0 LISTENING
http://localhost:5000/health
http://<YOUR_IP>:5000/health
Both should return: {"status":"OK","environment":"development"}
Option 1: Using curl (if installed)
curl http://10.83.12.71:5000/healthOption 2: Using PowerShell
Invoke-WebRequest -Uri "http://10.83.12.71:5000/health"If these fail, your PC's IP has changed!
Your WiFi IP address has changed from 10.83.12.71 to something else.
Solution:
- Run
ipconfigand note your current WiFi IPv4 address - Update mobile app:
// File: mobile_app/lib/services/api_service.dart (line 11) final String baseUrl = 'http://YOUR_NEW_IP:5000';
- Rebuild:
flutter build apk - Install:
flutter install --device-id=10BE5820BZ0009L
Windows Firewall might be blocking incoming connections.
Solution:
# Run PowerShell as Administrator
netsh advfirewall firewall add rule name="Flask Server" dir=in action=allow protocol=TCP localport=5000Or use Windows Firewall GUI:
- Open Windows Defender Firewall
- Click "Advanced settings"
- Click "Inbound Rules" → "New Rule"
- Port → TCP → 5000 → Allow the connection
- Name it "SafeCopy Backend"
Check:
- PC connected to WiFi:
YOUR_WIFI_NAME - Mobile connected to WiFi:
SAME_WIFI_NAME← Must match!
Solution:
- Connect both devices to the same WiFi network
- Disable mobile data on your phone
- Some WiFi routers have "AP Isolation" - disable it in router settings
If network issues persist, use ADB port forwarding:
# Forward mobile port 5000 to PC port 5000
adb -s 10BE5820BZ0009L reverse tcp:5000 tcp:5000Then in mobile app:
final String baseUrl = 'http://localhost:5000';This makes the app connect through USB instead of WiFi.
1. Find your current IP:
ipconfig | findstr IPv42. Test backend connectivity:
curl http://localhost:5000/health
curl http://YOUR_IP:5000/health3. Check if port 5000 is listening:
netstat -an | findstr :50004. Add firewall rule:
netsh advfirewall firewall add rule name="SafeCopy_Backend" dir=in action=allow protocol=TCP localport=50005. Test from mobile (using ADB):
adb -s 10BE5820BZ0009L shell curl http://YOUR_IP:5000/health- Backend server is running (
python app.py) - Server shows "Server running on http://0.0.0.0:5000"
- Both devices on same WiFi network
- Mobile data disabled on phone
- Firewall allows port 5000
- IP address in mobile app matches current PC IP
- Can access http://YOUR_IP:5000/health from PC browser
Backend console should show:
Server running on http://0.0.0.0:5000
Flask server started on port 5000
Mobile app should show:
Upload details:
Owner ID: surya@gmail.com
File name: environment_final_report_vf.pdf
Base URL: http://10.83.12.71:5000
✅ Public key retrieved successfully
✅ Symmetric key encrypted
📤 Uploading file...
✅ File uploaded successfully
NOT:
❌ Upload error: Get public key error: ClientException with SocketException: No route to host