python - I am receiving \\r\\n on carriage return instead of \r\n -


the project uses sockets read connecting client until either there no more characters read or receives \r\n. here snippet of code:

while true:     ch = connection.recv(1)     data += ch.decode('utf-8')     if data.endswith('\r\n') or not ch:         data = data.replace('\r\n','')         break 

the code works intended when windows used run server reads clients. when try run on raspberry pi running rasbian, reads carriage return '\\r\\n'. example when client sends:

-list_networks wlan0 5180<return> 

yields string looking like:

-list_networks wlan0 5180\\r\\n 

why this? because of not read carriage return , missed. know different os return different of strings carriage return didn't find string when researched bit. missing something? suggestions , explanations appreciated.

edit:

forgot add command sent through telnet connection. want able connect socket via telnet. type command , when enter key pressed command loop recognize , end loop.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -