-3

Good day.

I want to learn the basic ways in which computer protocols works, protocols like http, p2p, tcp/ip etc.

I've found many codes that implement those protocols and API's but each one has its own "uniqueness" in it - and to be honest many are just daunting.

At first I assumed most protocols can be represented as (relatively) simple pseudo-code or flowcharts design, Which (as far as I can tell after Google-ing for some time) wasn't true.

I would highly appreciated if any of you guys could point me to right path, and/or provide me with some useful hints.

  1. which code is better to learn from?
  2. what are the key elements to focus on?
  3. how can I tell which part of the code is an essential part of the protocol itself?

This questions might seem too trivial for some of you, but that's exactly why I'm choosing to post it here. Thanks!

shultz
  • 2,543
  • 3
  • 20
  • 23
  • 1
    This question appears to be too broad. There are many protocols, and while there are a few things all protocols have in common, there are far more differences among them. – dfeuer Aug 09 '14 at 09:28
  • Thanks for your comment. One of the key problem I'm facing is the difficulty in determine which implementation to stick with (and learn from) - looking through repositories of implementations the lists are just endless and I just can't seem to filter it. As for the protocols - I know that these protocols are as different from each other. – shultz Aug 09 '14 at 09:36
  • Before you start picking a protocol to explore, pick a purpose. What sorts of software do you want to write? What sorts of protocols does that software have to be able to implement (if any)? Once you've decided what sort of protocol you want to study, you can look within that category much more productively. – dfeuer Aug 09 '14 at 09:41
  • I don't want to write anything at the moment. I just want to learn. – shultz Aug 09 '14 at 09:42

1 Answers1

3

Before reading the code, you should read the protocol specification. Conversely, when implementing your own new protocol, you always should document that protocol (at the very least in a long comment).

Protocols like HTTP have a long and complex specification. e.g. RFC2616 or better RFC7230 and following. There are several books explaining HTTP.

binary vs textual protocol is a common issue. Textual protocols are easier to debug. Eg. JSON or something above it e.g. JSONRPC

In practice, you probably should use an existing library implementing that protocol. For HTTP in C (on Linux and Posix systems), you could use libcurl on the client side and libonion on the server side, but they are many alternatives.

Community
  • 1
  • 1
Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547
  • Thanks for your comment. One of the key problem I'm facing is the difficulty in determine which implementation to stick with (and learn from) - looking through repositories of implementations the lists are just endless and I just can't seem to filter it. As for the protocols - I know that these protocols are as different from each other. I'll check these libraries. – shultz Aug 09 '14 at 09:39