in reply to Re^2: How to build a tcp session with a remote server?
in thread How to build a tcp session with a remote server?

Tcip/ip is a transport layer. It is a way for the client to shovel data bits into a pipe and for the server to read those bits. This lower level protocol ensures that the bits that I send is what you get.

The next level higher is like: how many bits from you constitutes "one thing"? Maybe a fixed 256 bytes constitutes one "message". Maybe some string of characters which end in "\n" constitutes one "message". Maybe some number of lines that end in "\n" and a null line "\n" after all of the relevant lines constitutes collectively one "message". This is part of how the client "talks" to the server.

This is client<->server message protocol specific. Perl is great at "\n" terminated messages! I print one line to you and then I receive one line back. Perl can also deal with fixed byte length message packets.

Anyway all of this is related to the application I/F between client and server.

  • Comment on Re^3: How to build a tcp session with a remote server?

Replies are listed 'Best First'.
Re^4: How to build a tcp session with a remote server?
by JavaFan (Canon) on Aug 22, 2011 at 12:52 UTC
    Tcip/ip is a transport layer
    Assuming you mean TCP/IP here, you're wrong. Both TCP and IP are protocols (that's what the P in their names stand for). TCP is a protocol spoken on the transport layer (but there are more, of which UDP is probably the most well known). IP is another protocol, spoken on the internet layer (other protocols on said layer include ICMP, IGMP, and more).

    For the rest of your post, I've no idea what message you're trying to get across. But whatever it is, you're failing.

      No. I am completely correct.
      TCP/IP would correspond to layer 4, the transport layer of the OSI model. Just as I said.

      Transport means move bits from point A to B. Let's not get too whacked out on the number (layer 4 vs 5) because I think that number has changed over the years.

      What the OP wants to do is to talk to some server. He needs to be able to do more, a lot more than just "move bits" from A to B.

      What is required is to know what kind of messages are going to be sent. This is the how to interpret what I send and how to interpret what I receive as a client. Establishing a TCP/IP connection is just one step in the process - that's just the "get bits back and forth".

      Where I am failing here is that the whole idea of "talking to the server" means that there is an even higher level of protocol.

      Sorry that I'm not able to explain things better at the moment. Maybe some other Monks can help fill in the blanks.

        Well, if you follow your link you will see that you are not correct. TCP is a transport layer protocol, IP is a network (or following RFC 1122 terminology Internet) layer protocol. Also, there is no such thing as TCP/IP connection, TCP/IP is suite of protocols of different levels. Moving bits from host A to host B is the task for Internet layer, transport layer provides end-to-end communication between applications.
        Oh man, you're digging a deeper hole for yourself.

        There's the OSI model, and there's the Internet Protocol Suite (IPS). The former has 7 layers, all kinds of protocols for those layers, isn't currently used by any major OS, and neither used IP nor TCP (although both protocols are sometimes retrofitted in the OSI model). IPS has four layers: link layer, internet layer, transport layer and application layer. On each of those layers, there are many protocols. TCP is a protocol on the transport layer. IP is a different protocol on a different layer.

        Think about it. If TCP/IP would be a layer, surely UDP/IP would be a different layer. Which layer would it be? Above or below the TCP/IP layer?

        Transport means move bits from point A to B
        Wrong. Both in the OSI and in the IPS models. Moving bits around in the OSI model is the task of the Physical Layer, while in the IPS model, it is the task of the Link Layer (with protocols like Ethernet and ISDN, and many more). But note that some of the tasks of the IPS Link Layer are found in the Data Link Layer of the OSI model.

        TCP belongs in the Transport Layer (layer 3), which provides end-to-end communication. In the OSI model, this would correspond to the similary named Transport Layer (layer 4), but TCP also does some of the tasks found in the Session Layer (layer 5) of OSI (but not all of it - part of the tasks of the Session Layer are not found in the IPS model). IP on the other hand is found in the layer that does routing, and end-to-end delivery of datagrams. For the IPS model, this is the Internet Layer (layer 2), which corresponds to the Network Layer (layer 3) in the OSI model.

        Please, stop confusing protocols and layers.