First commit

This commit is contained in:
Yui
2026-05-02 20:54:01 -03:00
commit 1f6b38c894
9 changed files with 244 additions and 0 deletions

29
client/SocketClient.py Normal file
View File

@@ -0,0 +1,29 @@
import socket as s
from logging import Logger
from abc import ABC, abstractmethod
class SocketClient(ABC):
ip: str = ""
port: int = 0
socket: s.socket
logger: Logger
def __init__(self, ip: str, port: int, logger: Logger):
if port <= 0 or port > 65535:
raise ValueError("Port out of range.")
self.ip = ip
self.port = port
self.logger = logger
@abstractmethod
def Connect(self) -> bool:
pass
@abstractmethod
def Reconnect(self) -> bool:
pass
@abstractmethod
def Send(self, data: str):
pass