digitalmars.D - Extra socket output problem
- Ameer Armaly (5/5) Jul 21 2005 Hi all.
- Ben Hinkle (7/12) Jul 21 2005 Is it the length of the string about to be sent? I kindof doubt it since...
- Tim Laurent (6/13) Jul 27 2005 I encountered similar behaviour when I wrote a simple HTTP client. I
- Ben Hinkle (5/16) Jul 27 2005 note Ameer emailed me offline and he was reading using readLine and send...
Hi all. I am writing a telnet-like application, and am experiencing some strange behavior with my sockets. When the user hits enter, the text is sent, but before that 4 extra bytes (usually ctrl-b and 3 nulls) are sent. What does this mean, and how can I avoid it?
Jul 21 2005
"Ameer Armaly" <ameer_armaly hotmail.com> wrote in message news:dbo7ej$272m$1 digitaldaemon.com...Hi all. I am writing a telnet-like application, and am experiencing some strange behavior with my sockets. When the user hits enter, the text is sent, but before that 4 extra bytes (usually ctrl-b and 3 nulls) are sent. What does this mean, and how can I avoid it?Is it the length of the string about to be sent? I kindof doubt it since it would be odd if all your test strings had the same length. Posting some code would help. For example if you are using std.stream the method write(char[]) will first send the length and then the string contents. The result must be read using read (and watch out about endianness if you go this route).
Jul 21 2005
Ameer Armaly wrote:Hi all. I am writing a telnet-like application, and am experiencing some strange behavior with my sockets. When the user hits enter, the text is sent, but before that 4 extra bytes (usually ctrl-b and 3 nulls) are sent. What does this mean, and how can I avoid it?I encountered similar behaviour when I wrote a simple HTTP client. I cannot find the sources for it, but I ensured the client only sent an array of bytes (byte[]) - that way no other information is transmitted except what you explicitly specify. -Tim
Jul 27 2005
"Tim Laurent" <nanobyte gmx.com> wrote in message news:dc8gic$b4r$1 digitaldaemon.com...Ameer Armaly wrote:note Ameer emailed me offline and he was reading using readLine and sending using write so the first 4 bytes he saw were indeed the length of the string in platform-dependent byte order.Hi all. I am writing a telnet-like application, and am experiencing some strange behavior with my sockets. When the user hits enter, the text is sent, but before that 4 extra bytes (usually ctrl-b and 3 nulls) are sent. What does this mean, and how can I avoid it?I encountered similar behaviour when I wrote a simple HTTP client. I cannot find the sources for it, but I ensured the client only sent an array of bytes (byte[]) - that way no other information is transmitted except what you explicitly specify. -Tim
Jul 27 2005