Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Is there any difference between transmitting plain text/binary data?

Is there any difference between transmitting plain text/binary data?

Scheduled Pinned Locked Moved C / C++ / MFC
sysadmintutorialquestion
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    s_k
    wrote on last edited by
    #1

    Hi all, it makes me wonder if there is any difference between transmitting plain text/binary data over a socket. The main reason I think about it is that binary data can contain the whole range of ASCII characters, including some special characters (eg. 0x00 - NULL character). And I'm curious, whether any of these characters can cause any confusion when they're being transmitted. For example, when I'm developing some network application, can I ignore the character of the data which I want to transmit and can I use the same code for sending both types of data (plain text / binary data) ? Could somebody clarify this to me? Thanks.

    R 1 Reply Last reply
    0
    • S s_k

      Hi all, it makes me wonder if there is any difference between transmitting plain text/binary data over a socket. The main reason I think about it is that binary data can contain the whole range of ASCII characters, including some special characters (eg. 0x00 - NULL character). And I'm curious, whether any of these characters can cause any confusion when they're being transmitted. For example, when I'm developing some network application, can I ignore the character of the data which I want to transmit and can I use the same code for sending both types of data (plain text / binary data) ? Could somebody clarify this to me? Thanks.

      R Offline
      R Offline
      RadioShark
      wrote on last edited by
      #2

      Hi, there are no limitations on characters transmitted over the sockets. You may transmit any character from 0x00 to 0xFF. Some limitations (for example, in SMTP) were derived from protocol design. In case of SMTP, it was a possibility to use 7-bit encoding for message body. Sincerely Yours, RadioShark

      S 1 Reply Last reply
      0
      • R RadioShark

        Hi, there are no limitations on characters transmitted over the sockets. You may transmit any character from 0x00 to 0xFF. Some limitations (for example, in SMTP) were derived from protocol design. In case of SMTP, it was a possibility to use 7-bit encoding for message body. Sincerely Yours, RadioShark

        S Offline
        S Offline
        s_k
        wrote on last edited by
        #3

        Thank you RadioShark, that's very useful for me. Anyway I have couple of questions: 1) In source code of some network applications I've seen that before sending the data over socket, "\r\n" and '\0' was added to the data. Why? It is not neccessary, is it? 2) I have read someting about special characters, that could confuse modem when they are about to be transmitted. In other words, modem would probably consider them to be some special commands or what...Is it true? Thank you.

        R R 2 Replies Last reply
        0
        • S s_k

          Thank you RadioShark, that's very useful for me. Anyway I have couple of questions: 1) In source code of some network applications I've seen that before sending the data over socket, "\r\n" and '\0' was added to the data. Why? It is not neccessary, is it? 2) I have read someting about special characters, that could confuse modem when they are about to be transmitted. In other words, modem would probably consider them to be some special commands or what...Is it true? Thank you.

          R Offline
          R Offline
          RadioShark
          wrote on last edited by
          #4

          1. Sometimes "\r\n" is required by protocol design. Sometimes, a developer uses it for well-formatting of the source code. 2. Never mind about special characters. If the special character appears, it will be replaced automatically by escape-sequence. Sincerely Yours, RadioShark

          1 Reply Last reply
          0
          • S s_k

            Thank you RadioShark, that's very useful for me. Anyway I have couple of questions: 1) In source code of some network applications I've seen that before sending the data over socket, "\r\n" and '\0' was added to the data. Why? It is not neccessary, is it? 2) I have read someting about special characters, that could confuse modem when they are about to be transmitted. In other words, modem would probably consider them to be some special commands or what...Is it true? Thank you.

            R Offline
            R Offline
            Roger Wright
            wrote on last edited by
            #5

            When sending characters to a modem, the sequence '+++' causes it to interpret what follows as a command instead of data to be transmitted. But since commands begin with the sequence 'AT' (attention), if what follows is something other than this sequence the modem should revert back to its previous state. I suppose that deliberately sending +++ might cause it to lose those characters, but I've never tested it. Perhaps modem designers have taken this into account, and pass them on if a command doesn't follow them. Will Build Nuclear Missile For Food - No Target Too Small

            R 1 Reply Last reply
            0
            • R Roger Wright

              When sending characters to a modem, the sequence '+++' causes it to interpret what follows as a command instead of data to be transmitted. But since commands begin with the sequence 'AT' (attention), if what follows is something other than this sequence the modem should revert back to its previous state. I suppose that deliberately sending +++ might cause it to lose those characters, but I've never tested it. Perhaps modem designers have taken this into account, and pass them on if a command doesn't follow them. Will Build Nuclear Missile For Food - No Target Too Small

              R Offline
              R Offline
              RadioShark
              wrote on last edited by
              #6

              The original question was about sockets. The sequences 'AT' or '+++' will be used when you work with modem directly via serial port. Sincerely Yours, RadioShark

              R 1 Reply Last reply
              0
              • R RadioShark

                The original question was about sockets. The sequences 'AT' or '+++' will be used when you work with modem directly via serial port. Sincerely Yours, RadioShark

                R Offline
                R Offline
                Roger Wright
                wrote on last edited by
                #7

                I know, but the second question was about modems. Sockets don't care what's sent through them, as you pointed out nicely.:) Will Build Nuclear Missile For Food - No Target Too Small

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups