Tans5 / tFileTransfer_desktop

Desktop application to transfer/share files, support Windows, Linux and MacOS.
Apache License 2.0
38 stars 5 forks source link

Wrong broadcast address retrieved when multiple IPs configured on the same interface #1

Closed shunf4 closed 1 year ago

shunf4 commented 1 year ago

https://github.com/Tans5/tFileTransfer_desktop/blob/a1def7fb248ff6c661d7a86ffd222659bca8e21a/net/src/main/java/com/tans/tfiletransporter/netty/AddressUtils.kt#L10-L19

This possibly retrieves a wrong broadcast address (unmatches the selected IP) when the network interface is configured with multiple IP addresses. Then because the broadcast packet is sent to an incorrect destination, the other device is unable to discover current device.

For example, my configuration is as below and that's what happened:

image

Tans5 commented 1 year ago

Thanks for your report, I will check it. @shunf4

Tans5 commented 1 year ago

Could you check this commit is work? @shunf4

shunf4 commented 1 year ago

Android client seems successful finding the desktop PC's server now, but after I tap on the server entry, the connection doesn't succeed, with a toast saying only "Error".

Tans5 commented 1 year ago

Android client seems successful finding the desktop PC's server now, but after I tap on the server entry, the connection doesn't succeed, with a toast saying only "Error".

I also met this problem on low quality network. I am using UDP broadcast + UDP server now, maybe I should use UDP broadcast + TCP server.

shunf4 commented 1 year ago

Never mind, it's Windows Firewall. Applied proper settings to the firewall and everything worked. Thanks!