Is there any difference between transmitting plain text/binary data?
-
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.
-
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.
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
-
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
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.
-
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.
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
-
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.
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
-
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
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
-
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
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