Bug 115503 - Broadcast address
Summary: Broadcast address
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: Impress Remote
Classification: Unclassified
Component: Android Remote App (show other bugs)
Version:
(earliest affected)
2.2.3
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-06 22:27 UTC by Michael Mehl
Modified: 2018-12-03 13:19 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Mehl 2018-02-06 22:27:43 UTC
The built-in fixed broadcast address

   public static final String SERVER_SEARCH = "239.0.0.1";

does not work reliably.

I propose to use the following method to find the broadcast address:

   private InetAddress getBroadcastAddress() {
        try {
            for (NetworkInterface ni : Collections.list(NetworkInterface.getNetworkInterfaces())) {
                if (ni.isUp()) {
                    for (InterfaceAddress addr : ni.getInterfaceAddresses()) {
                        if (!addr.getAddress().isLoopbackAddress()) {
                            return addr.getBroadcast();
                        }
                    }
                }
            }
        } catch (SocketException ex) {
            // ignore
        }
        throw new RuntimeException("no broadcast address found");
    }

In the class "TcpServersFinder" the method buildSearchPacket could use this method:

    private DatagramPacket buildSearchPacket() {
        String aSearchCommand = Protocol.Commands
            .prepareCommand(Protocol.Commands.SEARCH_SERVERS);

        DatagramPacket aSearchPacket = new DatagramPacket(
            aSearchCommand.getBytes(), aSearchCommand.length());

        aSearchPacket.setAddress(getBroadcastAddress());
        aSearchPacket.setPort(Protocol.Ports.SERVER_SEARCH);

        return aSearchPacket;
    }
Comment 1 Michael Mehl 2018-02-06 23:00:33 UTC
This solution is also not fully working: the broadcast should be sent to all network interfaces. I tried the following:
- connect computer to android via mobile hotspot
If the android is also connected to the internet via the mobile network then the broadcast is sent to the mobile network (where it is suppressed).
If the mobile network ob the android is disabled, then the connected computer is found.
Comment 2 Xisco Faulí 2018-02-07 19:24:42 UTC
Could you please create a patch a submit it to gerrit as explained here https://wiki.documentfoundation.org/Development/gerrit/SubmitPatch ?
Comment 3 Michael Mehl 2018-02-07 20:42:04 UTC
Creating a patch is possible. 

Maybe we should first discuss the options:
* current solution uses multicast (seems to have problems in some networks, e.g. mobile hotspot)
* my solution uses some API call to get a broadcast address

For me it is not clear if my solution is really better.
Comment 4 Xisco Faulí 2018-02-07 22:20:27 UTC
Could you please then write an email to the dev mailing list ? https://wiki.documentfoundation.org/Development/Mailing_List
Comment 5 Xisco Faulí 2018-03-15 10:10:29 UTC
Hi Michael,
Any update here?
Comment 6 Xisco Faulí 2018-05-02 10:26:06 UTC
(In reply to Xisco Faulí from comment #4)
> Could you please then write an email to the dev mailing list ?
> https://wiki.documentfoundation.org/Development/Mailing_List

Hi Michael Mehl,
have you sent the email to the dev list in order to get the topic discussed?
Comment 7 QA Administrators 2018-11-05 16:08:21 UTC Comment hidden (obsolete)
Comment 8 QA Administrators 2018-12-03 13:19:57 UTC
Dear Bug Submitter,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-20181203