40

I am not very clear about the idea of wire-level protocols. I heard BitTorrent uses it and read that a wirelevel protocol can be considered an opposite of API. I read RMI calls can be considered wirelevel protocols but am still a little confused. Can someone explain this in a better way?

Legend
  • 113,822
  • 119
  • 272
  • 400

3 Answers3

26

I wouldn't say that something uses a wire-level protocol or doesn't - I'd talk about which wire-level protocol it uses.

Basically, if something's communicating with a remote machine (even conceptually) then there's some data going across the network connection (the wire). The description of that data is the "wire-level protocol". Even within that, you would often stop short of describing individual network packets - so the wire protocol for a TCP-based protocol would usually be defined in terms of opening a connection, the data streams between the two computers, and probably details of when each side would be expected to close the connection.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • Thank You. So does everything eventually end up using some or the other wire-level protocol? – Legend Feb 24 '10 at 06:32
  • 2
    There's more to it than that though - "wire level protocol" is a specific term which implies that there is a method-invocation-like interface in the protocol, e.g. SOAP, RMI, etc., or even SQL. I think of it a bit more like an API specified in terms of RPC than a particular language. – Eric Warmenhoven Feb 24 '10 at 06:33
  • 2
    Trying to tie this answer with some of the text in the question. Once you happily handle literal wire level protocols (as above) you can "consider" higher level concepts as wire level protocols. Typically, you do not need to worry about which wire level protocol is in use from your source code. It is either setup correctly and works, or it is not. I think "RMI calls can be considered wire level protocols" is basically saying that you can make the call without worrying about the technology between your call and the receiving side as if you were using a wire level protocol like TCP/IP. Jacob – TheJacobTaylor Feb 24 '10 at 06:35
  • @Eric: I don't see an implication of a method-invocation-like interface in the protocol. You could easily describe the wire level protocol of ping, NTP etc. Now I suppose you *could* think of those as being RMI-like (ping = "return true", NTP = "return the current time") but at that stage you're left wondering what network traffic *isn't* RMI-like. I see no reason to restrict the term "wire level protocol" to RMI. – Jon Skeet Feb 24 '10 at 07:05
  • @Jon: Fair enough, even at the TCP level you *could* think of e.g. a SYN packet being an invocation to connect, with the logical "return value" being either an ACK (success) or a RST (failure).... But you *wouldn't* think of it this way, because it's not natural. Whereas request/response protocols are much more naturally thought of as method invocation. It's a subtle difference to be sure, but an interesting one at least. – Eric Warmenhoven Feb 24 '10 at 07:22
  • Just as a final note, I read this sentence: "The bittorrent wire protocol is very simple. It is just plain HTTP requests and responses sent using something called "bencoding". The bencoding part is the wire-protocol here? – Legend Feb 24 '10 at 16:05
  • @Legend: Yes, that sounds like it's part of the wire protocol. – Jon Skeet Feb 24 '10 at 16:21
4

I googled and found the following:

Examples:

  • HTTP
  • CORBA
  • DCOM
  • SOAP

Did you try this yourself? If so, what don't you understand?

Community
  • 1
  • 1
hobodave
  • 28,925
  • 4
  • 72
  • 77
  • 2
    Sure. I did google and came across those links myself. Just that from what I learnt HTTP is an Application Layer protocol. When can I call it a wirelevel protocol is something that is confusing me... – Legend Feb 24 '10 at 06:45
4

Quoting the answer posted here

A wire-level protocol can be thought of as the complement of an API. Instead of defining functions and creating libraries, you define the conversational byte sequences that pass over a network to make things happen.

When a protocol is specified at the wire-level and published, most technologies can use it, or be made to use it. Compare this to an API, where the actual implementation is specific to the platform.

JMS is an API. HTTP is a protocol. AMQP delivers the middleware equivalent of HTTP while leaving it up to others to provide implementations.

Keshaw Kumar
  • 317
  • 1
  • 4
  • 15