in reply to Cant get user input from sockets into variables.

Greetings.
If you described what and how does not work, it would be helpful.
But from the looks of it, I'd call binmode() on all the filehandles, then remove lone <CR>, <NL>, or <CR><NL> pairs (it' is \r\n, not the other way around, by the way).

I'd also like to point out that the telnet protocol - accused in the comment of another monk - is completely innocent and quite different from what is going on here :). It is nevertheless true that EOL terminators on the network are tricky to get right... I believe that there is a good discussion of them in the docs, (perlipc ?)

Cheers,
alf

  • Comment on Re: Cant get user input from sockets into variables.

Replies are listed 'Best First'.
Re: Re: Cant get user input from sockets into variables.
by wog (Curate) on Sep 22, 2001 at 19:03 UTC
    The telnet standard says that LF should be considered to move the printer to the next line in the same horizontal position and that CR should be considered to move the printer to beginning of the current line, and that...
    the sequence "CR LF" must be treated as a single "new line" character and used whenever their combined action is intended
    Implying that CR LF is going to be the only newline sequence you will recieve in a telnet stream which is presumably being used here. So there is no need to check for just CR or LF/NL.

    Also, note that \r\n is not portable between platforms -- \n and \r are swapped on Macs (because CR is used to terminate lines on Macs, not LF/NL.)