-
Notifications
You must be signed in to change notification settings - Fork 3k
netsocket: add get_remote_peer() method to InternetSocket #8565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thank you for the contribution, we will review and provide feedback (someone from the @ARMmbed/mbed-os-ipcore team) |
I feel like it should be All other functions inherit the name and behaviour from POSIX as well. |
@SeppoTakalo I have renamed to |
Also, sorry, I'm still waiting on signed CLA >_< |
Discussed this with @SeppoTakalo - it's probably best to incorporate the API all the way up in the base This is related to #5922 - we concluded there that If it goes all the way up to |
* | ||
* @return pointer to the remote_peer SocketAddress | ||
*/ | ||
const SocketAddress* getpeername(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For lifetime reasons and general POSIX compatibility - aligning with the way we've mapped other functions - this should be prototyped as virtual nsapi_error_t getpeername(SocketAddress *address)
, assuming implementing a pure virtual in Socket
as suggested.
(Other calls already omit the POSIX length parameter for addresses, on the assumption SocketAddress
has space for all possible address types...)
Park this change. We as a IP networking team will do this change so that it will become official part of Mbed OS Socket API. |
API change submitted in #8651 |
@unsignedint Please review 8651. We will close this PR as 8651 extends it. Thank you for your first contribution |
Description
With the TCP API changes in 5.10 it seems like there is now no easy way to access the address information of the remote peer, because it is not exposed in the protected
_remote_peer
member. This PR adds a get method to expose it as aconst
pointer.The end goal is to replicate previous behaviour from 5.9:
And now we can write:
Pull request type
I have labeled this a "fix" but it can be considered an enhancement, too, I guess.