Trying to get data from a TCP socket connection on a networked device using Python
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Future Grid Looping
--
Chapters
00:00 Trying To Get Data From A Tcp Socket Connection On A Networked Device Using Python
02:07 Accepted Answer Score 1
02:22 Thank you
--
Full question
https://stackoverflow.com/questions/6750...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #sockets #tcp
#avk47
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Future Grid Looping
--
Chapters
00:00 Trying To Get Data From A Tcp Socket Connection On A Networked Device Using Python
02:07 Accepted Answer Score 1
02:22 Thank you
--
Full question
https://stackoverflow.com/questions/6750...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #sockets #tcp
#avk47
ACCEPTED ANSWER
Score 1
The devices communicate line-oriented with lines terminated by \r, so just read a whole line - replace the while True loop with
data = s.makefile(newline='\r').readline()
f.write(data) # Write data to logfile