Skip to content

Add TLSSocket example #11

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 2 commits into from
Nov 14, 2018
Merged

Add TLSSocket example #11

merged 2 commits into from
Nov 14, 2018

Conversation

SeppoTakalo
Copy link
Contributor

This is nearly a verbatim copy of Socket examples, but now uses TLSSocket.

@SeppoTakalo
Copy link
Contributor Author

@AnotherButler Please review & merge.

Will be linked into the ongoing TLSSocket documentation PR

@cmonr cmonr requested a review from AnotherButler November 8, 2018 17:05
Copy link
Contributor

@cmonr cmonr left a comment

Choose a reason for hiding this comment

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

🎉

@SeppoTakalo
Copy link
Contributor Author

@kjbracey-arm FYI

@cmonr cmonr requested a review from kjbracey November 9, 2018 14:24
Copy link

@kjbracey kjbracey left a comment

Choose a reason for hiding this comment

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

Lots of nit-picks, cos it's an example. Bet most are common with the other socket example though.

// Bring down the ethernet interface
net->disconnect();
printf("Done\n");
}
Copy link

Choose a reason for hiding this comment

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

Missing newline

size = strlen(query);

// Loop until whole request sent
while(size) {
Copy link

@kjbracey kjbracey Nov 9, 2018

Choose a reason for hiding this comment

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

This loop should not be necessary. A blocking socket or file handle is supposed to send everything. (In Unix a signal could interrupt, but not mbed OS).

See ARMmbed/mbed-os#5466 - loop would have been necessary in older OS versions.

Following the logic from that PR, if TLSSocket needs the loop, it should be fixed to match TCPSocket.

Missing space, anyway

return result;
}

TLSSocket *socket = new TLSSocket;
Copy link

Choose a reason for hiding this comment

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

As you've configured a big main stack, no particular reason to new this? Or the buffer?

NetworkInterface *net = NetworkInterface::get_default_instance();

if (!net) {
printf("Error! No network inteface found.\n");
Copy link

Choose a reason for hiding this comment

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

interface

@SeppoTakalo SeppoTakalo merged commit 2502db9 into ARMmbed:master Nov 14, 2018
@SeppoTakalo SeppoTakalo deleted the TLSSocket branch November 14, 2018 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants