osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Losing words


On 2019-04-01, Jon Ribbens <jon+usenet at unequivocal.eu> wrote:
> On 2019-04-01, John Doe <john at johniedoe.com> wrote:
>> 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.
>
> Your problem isn't with Python (although as others have mentioned you
> should be using .sendall not .send) but with the IRC protocol - you
> need to prefix the message with a ':'. Also technically you should
> be using '\r\n' not '\n' at the end but I should imagine most servers
> don't care.

sendall also is not sending a whole sentence. I used to have '\r\n' as
well no changes in sending a string at all then must be as you're saying
that most don't care.