On Sat, Jan 30, 2021, at 11:50, Bischoop wrote:
> 
> Got problem with responding for Ping, tried so many ways to response
> and always end up with time out or other error. This time:

1. It looks like you're forgetting to send \n\r
2. i'm not sure if the server ping is guaranteed to have : character
3. if it does have : character you need to send everything after it even if it 
includes spaces
4. what happens if the data in recv includes more than one line of data, or 
partial line at the end? this isn't a proper way to handle irc protocol in 
general, let alone the ping command

> ERROR :(Ping timeout: 264 seconds)
> Traceback (most recent call last):
>     s.send(bytes('PONG ' + data.split()[1], 'UTF-8'))
> BrokenPipeError: [Errno 32] Broken pipe
> 
> while True:
>     time.sleep(2)
>     data=s.recv(2040).decode('utf8')
>     data = data.strip("\n\r")
>     print(data)
>     if data.find ("PING :"):
>         s.send(bytes('PONG ' + data.split()[1], 'UTF-8'))
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to