Losing words

David Raymond David.Raymond at tomtom.com
Mon Apr 1 10:39:32 EDT 2019


.send returns the number of bytes that it actually succeeded in sending. From the docs: "Applications are responsible for checking that all data has been sent; if only some of the data was transmitted, the application needs to attempt delivery of the remaining data."

You could also switch to using .sendall, which will do retries for you.

But in either case you get a return code which lets you know if everything went through ok.

-----Original Message-----
From: Python-list [mailto:python-list-bounces+david.raymond=tomtom.com at python.org] On Behalf Of John Doe
Sent: Monday, April 01, 2019 9:39 AM
To: python-list at python.org
Subject: Losing words

I'm learning SOCKETS and working with Irc.
 s.send(bytes("PRIVMSG " + channel +" "+ message + "\n", "UTF-8"))
 When more than one word ( for example: This is a message) 
 in *message* it sends the FIRST word only "This" and skips the rest.
 Any ideas how to solve the problem? I was seating on it on the night
 but nothing came up.

More information about the Python-list mailing list