berconpy.AsyncClientProtocol¶
- class berconpy.AsyncClientProtocol¶
Bases:
ABCProvides a bridge between
RCONClientand the underlying I/O implementations.Methods
close()Notifies the protocol that it should begin closing.
Indicates if the client has a currently active connection with the server.
Indicates if the client is currently authenticated with the server.
Indicates if the client is running.
run(ip, port, password)Starts maintaining a connection to the given server.
send(packet)Sends a packet to the server.
send_command(command)Attempts to send a command to the server and read the server's response.
Waits indefinitely until the client has received a login response or the connection has closed.
Attributes
LAST_RECEIVED_TIMEOUTclient- abstract is_connected()¶
Indicates if the client has a currently active connection with the server.
- Return type:
- abstract is_logged_in()¶
Indicates if the client is currently authenticated with the server.
- Return type:
- Returns:
True if authenticated or None if no response has been received from the server.
- Raises:
LoginFailure – The client failed to log into the server.
- abstract is_running()¶
Indicates if the client is running. This may not necessarily mean that the client is connected.
- Return type:
- abstract run(ip, port, password)¶
Starts maintaining a connection to the given server.
- Return type:
Task[None]- Returns:
A task that will handle connections to the server.
- Raises:
RuntimeError – This method was called while the protocol was already connected.
- abstract async send_command(command)¶
Attempts to send a command to the server and read the server’s response.
- Parameters:
command (
str) – The command string to send.- Return type:
- Returns:
The server’s response as a string.
- Raises:
RCONCommandError – The server failed to respond to all attempts.
- abstract async wait_for_login()¶
Waits indefinitely until the client has received a login response or the connection has closed.
This can also raise any exception when the connection finishes closing.
- Return type:
- Returns:
True if authenticated, False otherwise.
- Raises:
LoginFailure – The client failed to log into the server.