{"action":"created","issue":{"url":"https://api.github.com/repos/eclipse/californium/issues/741","repository_url":"https://api.github.com/repos/eclipse/californium","labels_url":"https://api.github.com/repos/eclipse/californium/issues/741/labels{/name}","comments_url":"https://api.github.com/repos/eclipse/californium/issues/741/comments","events_url":"https://api.github.com/repos/eclipse/californium/issues/741/events","html_url":"https://github.com/eclipse/californium/issues/741","id":355849487,"node_id":"MDU6SXNzdWUzNTU4NDk0ODc=","number":741,"title":"Tips for making an request to an broadcast address.","user":{"login":"auxor","id":5031992,"node_id":"MDQ6VXNlcjUwMzE5OTI=","avatar_url":"https://avatars1.githubusercontent.com/u/5031992?v=4","gravatar_id":"","url":"https://api.github.com/users/auxor","html_url":"https://github.com/auxor","followers_url":"https://api.github.com/users/auxor/followers","following_url":"https://api.github.com/users/auxor/following{/other_user}","gists_url":"https://api.github.com/users/auxor/gists{/gist_id}","starred_url":"https://api.github.com/users/auxor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/auxor/subscriptions","organizations_url":"https://api.github.com/users/auxor/orgs","repos_url":"https://api.github.com/users/auxor/repos","events_url":"https://api.github.com/users/auxor/events{/privacy}","received_events_url":"https://api.github.com/users/auxor/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-08-31T05:58:37Z","updated_at":"2018-11-07T10:36:49Z","closed_at":"2018-08-31T05:59:20Z","author_association":"NONE","body":"This is not an issue, just for recording tips which may help someone. It's not defined in rfc and is not recommended.\r\n\r\nI am using 2.0.0-M11. By default, californium can not handle response after making an request to an broadcast address. Because of the following reasons:\r\n\r\n1. The request's destination address is a broadcast address (like 192.168.1.255), but the response's address is an real address(like 192.168.1.4).  The response will be discard by [isResponseRelatedToRequest](https://github.com/eclipse/californium/blob/984cbaea63996c66d1d5adb2d27fb2b2ea41bed1/element-connector/src/main/java/org/eclipse/californium/elements/UdpEndpointContextMatcher.java#L68)\r\n2. If you have start an sever, the server will receive the broadcast request too, and response an 4.04. \r\n\r\nWith the following changes, you will get correct response after making an request to an broadcast address. (Note, only the first response will be handled)\r\n\r\n1. Create an your endpoint, and set response matching to relexed. Then it will discard any response.\r\n`        NetworkConfig config = NetworkConfig.getStandard();\r\n        config.setString(NetworkConfig.Keys.RESPONSE_MATCHING, \"RELAXED\");\r\n`\r\n2. If you have start an server, custom an ServerMessageDeliverer and override preDeliverRequest. Then the server will not response to itself.\r\n`\r\nprotected boolean preDeliverRequest(final Exchange exchange) {\r\n        if (exchange != null ) {\r\n            Request request = exchange.getRequest();\r\n            if (request.getSourceContext() != null) {\r\n                String sourceAddr = request.getSourceContext().getPeerAddress().getHostName();\r\n                if (\"YOUR LOCAL ADDRESS\".equals(sourceAddr)) {\r\n                    return true;\r\n                }\r\n            }\r\n        }\r\n        return false;\r\n }\r\n`\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/eclipse/californium/issues/comments/436580316","html_url":"https://github.com/eclipse/californium/issues/741#issuecomment-436580316","issue_url":"https://api.github.com/repos/eclipse/californium/issues/741","id":436580316,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjU4MDMxNg==","user":{"login":"boaks","id":10937819,"node_id":"MDQ6VXNlcjEwOTM3ODE5","avatar_url":"https://avatars2.githubusercontent.com/u/10937819?v=4","gravatar_id":"","url":"https://api.github.com/users/boaks","html_url":"https://github.com/boaks","followers_url":"https://api.github.com/users/boaks/followers","following_url":"https://api.github.com/users/boaks/following{/other_user}","gists_url":"https://api.github.com/users/boaks/gists{/gist_id}","starred_url":"https://api.github.com/users/boaks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boaks/subscriptions","organizations_url":"https://api.github.com/users/boaks/orgs","repos_url":"https://api.github.com/users/boaks/repos","events_url":"https://api.github.com/users/boaks/events{/privacy}","received_events_url":"https://api.github.com/users/boaks/received_events","type":"User","site_admin":false},"created_at":"2018-11-07T10:36:49Z","updated_at":"2018-11-07T10:36:49Z","author_association":"CONTRIBUTOR","body":"Thanks for your feedback."}}
{"actor":{"display_login":"boaks"}}