Files
sampy/sampy/client/base.py
2020-03-29 19:12:31 +02:00

20 lines
522 B
Python

import socket
import struct
from ..struct.server import ServerConfig
import logging
logger = logging.getLogger(__name__)
class BaseClient:
def __init__(self, config: ServerConfig, socket: socket.socket, ip: str, port: int):
self.config = config
self.socket = socket
self.ip = ip
self.port = port
self.ip_uint, = struct.unpack(b"<I", bytes(int(x) for x in self.ip.split(".")))
async def on_packet(self, packet: bytes):
logger.debug("on_packet(%s)" % packet)