Module: nintendo.nex.rmc

Provides a client and server for the RMC protocol. An alternative client that calls remote methods through HTTP can be found in the nintendo.nex.hpp module.

class RMCResponse
Generic response object that is returned when a remote method returns multiple values. The attributes depend on the method.

class RMCClient
RMC client that uses a PRUDP connection.

async with connect(settings: Settings, host: str, port: int, vport: int = 1, context: TLSContext = None, credentials: Credentials = None, servers: list[object] = []) -> RMCClient
Creates an RMC client based on PRUDP and connects it to the given address. If context is provided, and the underlying transport supports this, the connections is secured with TLS. If credentials are provided they are sent to the server in the connection request. Blocks until the connection is ready and handshake has been performed. servers must be a list of service implementations.

async with serve(settings: Settings, servers: list[object], host: str = "", port: int = 0, vport: int = 1, context: TLSContext = None, key: bytes = None) -> None
Creates an RMC server based on PRUDP and binds it to the given address. If host is empty, the local address of the default interface is used. If port is 0, it is chosen by the operating system. If context is provided, and the underlying transport supports this, the server is secured with TLS. If key is provided it is used to decrypt the Kerberos tickets in connection requests. If key is None, the payload of connection requests is ignored and all client connections are accepted. servers must be a list of service implementations.

async with serve_on_transport(settings: Settings, servers: list[object], transport: PRUDPServerTransport, port: int, key: bytes = None) -> None
Creates an RMC server on top of the given transport server. If key is provided it is used to decrypt the Kerberos tickets in connection requests. If key is None, the payload of connection requests is ignored and all client connections are accepted. servers must be a list of service implementations.

RMCClient

async def request(protocol: int, method: int, body: bytes, noresponse: bool = False) -> bytes
Performs a remote method call. Blocks until the RMC is complete. Returns the body of the RMC response on success. Raises RMCError if the server returns an error code.

If noresponse is True, this method does not wait for a response and returns None immediately.

async def close() -> None
Closes the connection forcefully by sending an unreliable disconnect packet three times.

async def disconnect() -> None
Closes the connection gracefully by sending a reliable disconnect packet.

def pid() -> int
Returns the user id of the connected client. Returns None if the client is connected without credentials.

def local_address() -> tuple[str, int]
Returns the local address of the client.

def remote_address() -> tuple[str, int]
Returns the address that the client is connected to.

def local_sid() -> int
Returns the local stream id (PRUDP port).

def remote_sid() -> int
Returns the remote stream id (PRUDP port).