|
|
|
@ -21,10 +21,13 @@
|
|
|
|
|
import asyncio
|
|
|
|
|
import struct
|
|
|
|
|
import sys
|
|
|
|
|
from rich.console import Console
|
|
|
|
|
from rich.prompt import Prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ProducerClient:
|
|
|
|
|
BUFFER_SIZE = 1024
|
|
|
|
|
console = Console()
|
|
|
|
|
|
|
|
|
|
def __init__(self, ip: str, port: int):
|
|
|
|
|
self.__ip = ip
|
|
|
|
@ -34,6 +37,7 @@ class ProducerClient:
|
|
|
|
|
|
|
|
|
|
async def connect(self):
|
|
|
|
|
self.reader, self.writer = await asyncio.open_connection(self.__ip, self.__port)
|
|
|
|
|
self.console.print(f'[yellow b][INFO][/] Connected to the server ({self.__ip}:{self.__port}).')
|
|
|
|
|
|
|
|
|
|
async def send(self, message: str):
|
|
|
|
|
self.writer.write(struct.pack('<L', len(message)))
|
|
|
|
|