How to write(implement) a network protocols such as ftp, bittorrent, adc, gnutella etc?
What were used language? where donwloads sources? I was reads to used boost.asio, boost.spirit, beep, type length value, what better choose?
How to write(implement) a network protocols such as ftp, bittorrent, adc, gnutella etc? What
Share
Are you talking about implementing an existing protocol, or creating a new one? I will assume the former.
The first thing you need is the specification. Standard internet protocols are specified by RFCs. For example, FTP is specified by RFC 959. The other protocols you mention are not standards, but they may still have specifications; for example, BitTorrent has one, although it isn’t very good (there’s an attempt to clarify it).
The second thing you need is a language with an API for doing socket IO. Every serious language has one. In Java, for example, it’s in the java.net package. You can use any language, as long as it has such an API.
Then you just need to sit down and follow the specification, and write code which can send and receive messages in the format defined in the specification.
Alternatively, you could look for an existing implementation of the protocol, and use that. There is no centralised place to find implementations of protocols; your language’s standard library will contain some (for example, Java has FTP, HTTP, SMTP, IIOP, and maybe some others built in), and you may be able to download others as third-party packages.
You mention a few libraries. Boost.asio is a library for socket IO in C++. It’s a layer on top of the basic operating system API that aims to make it easier. Boost.spirit is a parser library; you could use it to parse a protocol, although that would only be a good move for the more complex protocols. BEEP is a protocol, or rather a framework for building protocols; it would only help you with a protocol implemented on top of BEEP, which most protocols are not. Tag-length-value is a style of data encoding, which some protocols use, but not all.