Skip to content

Implement Socket::getpeername() API #8651

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

Merged
merged 1 commit into from
Nov 14, 2018
Merged

Conversation

SeppoTakalo
Copy link
Contributor

@SeppoTakalo SeppoTakalo commented Nov 6, 2018

Description

This is equivalent of POSIX getpeername() function. It allows to
get remote address associated with the socket.
For example:

socket *s = server.accept();
SocketAddress remote;
s->getpeername(&remote);

This is a new API so should go out on 5.11, and not in 5.10 patch releases.

NOTE: This PR replaces the change proposed in #8565

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[X] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

@SeppoTakalo
Copy link
Contributor Author

@kjbracey-arm and @ARMmbed/mbed-os-ipcore Please review.

Copy link

@unsignedint unsignedint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet

@cmonr cmonr requested a review from a team November 8, 2018 16:41
@0xc0170
Copy link
Contributor

0xc0170 commented Nov 9, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Nov 9, 2018

Build : FAILURE

Build number : 3590
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/8651/

if (!_remote_peer) {
return NSAPI_ERROR_NO_CONNECTION;
}
*address = _remote_peer;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this function need a return value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thank you.

This is equivalent of POSIX getpeername() function. It allows to
get remote address associated with the socket.
For example:
socket *s = server.accept();
SocketAddress remote;
s->getpeername(&remote);
@SeppoTakalo
Copy link
Contributor Author

Build error fixed and added a unit test for InternetSocket::getpeername()

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 13, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Nov 13, 2018

Build : SUCCESS

Build number : 3610
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/8651/

Triggering tests

/morph test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Nov 13, 2018

@mbed-ci
Copy link

mbed-ci commented Nov 13, 2018

@cmonr
Copy link
Contributor

cmonr commented Nov 13, 2018

Note: This PR is now a part of a rollup PR (#8733).

In order to expidite remaining CI testing, this PR has been bundled into the above rollup PR.

No further work is needed here, as once that PR is merged, this PR will also be closed and marked as merged.

If any more commits are made in this PR, this PR will remain open and have to go through CI on its own.

@0xc0170 0xc0170 merged commit 619bcb5 into ARMmbed:master Nov 14, 2018
@0xc0170 0xc0170 removed the needs: CI label Nov 14, 2018
@cmonr cmonr removed the rollup PR label Nov 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants