EOL for sys.stdin.readline() and raw_input()

J

jkv

Hi,

Are there any way to change the EOL character for sys.stdin.readline()
and raw_input()?
My problem is that i cannot rely on that the clients connection to my
application will end all lines with \n or \r\n. Sometimes they will use
\r\000 as EOL.

Example from my code:

sys.stdout.write('Password: ');
#IAC DO ECHO
sys.stdout.write('\xFF\xFB\x01')
password = raw_input()

If the client sends 'qwerty\r\n' everything is fine and the password get
stored in the variable. But sometimes, depending on how broken the
telnet client are, the client will send 'qwerty\r\000' instead and then
my application will hang at 'password = raw_input()' forever.

Any suggestions?

Regards,
jkv
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top