How to check if the server is connected in python asyncore module

247 views Asked by At

I want to create a client that automatically reconnects if it loses the connection to the server. Therefore I ofcourse need to know if the server is connected. I want to use the asyncore module. My initial geuss would be to check

dispatcher.connected

However, since the socket is non-blocking, there is always a EWOULDBLOCK error returned. Therefore before every connect I have to set the socket to non-blocking, try to connect and set it to blocking again.

Am I missing something here? Since the default code always returns an error( on windows atleast) the base implementation always says non-connected whilest in fact, it is connected.

0

There are 0 answers