Skip to content

Proposal for added method to WiFiUDP class: WiFiUDP::ipDst() #295

@jonnyns

Description

@jonnyns

I would like to suggest an added method
IPAddress WiFiUDP::ipDst() to get the destination ip address of a received packet
similar to the existing
IPAddress WiFiUDP::remoteIP()
in the WiFiUDP class.

The use case is the simultaneous use of the same port number for unicast and multicast packet receipt, where one might have a need to treat these packet receipt channels differently.

If I - for a server - register a multicast address for port N and at the same time register a server socket for the same port N, I currently see no way to differentiate whether a packet did arrive because of a client unicast call of because of a client multicast call.

I can make a call to WiFiUDP::remoteIP() to find the address of the packet sender, but there is no way AFAIK to find the destination address of the packet, which I would need in order to resolve unicast from multicast.
The WiFiUDP::read() call will only return data above the UDP layer, so there is no way to look at the relevant packet data directly.

A real case is for the application protocol COAP where port 5683 is used in both cases.

If I should have overlooked another way of achieving this, please feel free to inform me.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: enhancementProposed improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @per1234@jonnyns

        Issue actions

          Proposal for added method to WiFiUDP class: WiFiUDP::ipDst() · Issue #295 · arduino-libraries/WiFiNINA