Re: Networking API example code
As we were requested at the TSC meeting to keep the discussion public
at the devel mailing list, please let me re-route this conversation
I also apologize for delayed response - there were public holidays
here. Please see responses below.
On Fri, 27 Apr 2018 15:10:18 +0300
Patrik Flykt <email@example.com> wrote:
Here is a fairly simple piece of C code that we can use to demonstrateAs I mentioned in my previous mail (dated Apr 26,
Zephyr tree includes 5 ready socket examples which demonstrate socket
API from various angles and are known to work. I proposed to use one of
them to demonstrate TLS API approaches.
Your going forward with an adhoc example may leave an impression that
your API can't work with existing examples, and require an artificial
one - which is definitely not true.
But your going with a single-source-file example also hides what the
existing Zephyr socket samples are. They are fully self-contained
(albeit small and "toy") applications with build files included, and
these build files demonstrate thess apps working on both Zephyr and a
reference POSIX system (tested with Linux).
Samples for my Zstream API preserve this continuity. And that's where
your API would have problems. And I hope it's not just me who's keen to
see how you'd resolve that.
So, I hope you had time over the last week also convert one of the
to your API and test it with both Zephyr and a POSIX system.
Oh, and btw, your sample code had a mistake, so couldn't work as is, I
had to fix it.
Fairly speaking, Zstream was at that stage - discussing individual
calls in a presentation-like manner circa beginning of February (and
that was done on github). The way I understood TSC's request is to
prepare 2 more or less real-world samples to compare 2 APIs. I didn't
try to squeeze mine into the presentation slides. I also let Github diff
viewer do the coloring:
This is your sample, as-is from the mail.
This adds missing connect() call, and build files for Zephyr and POSIX.
This represents a working, testable sample.
This shows the changes required to convert socket-based sample to
Zstream-based sample, still preserving buildability and functioning on
both Zephyr and POSIX.
(Links are valid until git rebase.)
Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog