From 8959d491b2d26b09035979e6f525c2dfed464003 Mon Sep 17 00:00:00 2001 From: Stuckinaboot Date: Wed, 31 Oct 2018 22:39:47 +0100 Subject: [PATCH] Implement raw connection --- connection/raw_connection.py | 10 ++++++++++ connection/raw_connection_interface.py | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/connection/raw_connection.py b/connection/raw_connection.py index e69de29..e2782c8 100644 --- a/connection/raw_connection.py +++ b/connection/raw_connection.py @@ -0,0 +1,10 @@ +from .raw_connection import IRawConnection + +class RawConnection(IRawConnection): + + def __init__(self, ip, port): + self.ip = ip + self.port = port + + async def open_connection(self): + self.reader, self.writer = await asyncio.open_connection(self.ip, self.port) diff --git a/connection/raw_connection_interface.py b/connection/raw_connection_interface.py index e69de29..5e0f394 100644 --- a/connection/raw_connection_interface.py +++ b/connection/raw_connection_interface.py @@ -0,0 +1,13 @@ +from abc import ABC, abstractmethod +import asyncio + +class IRawConnection(ABC): + + @abstractmethod + def __init__(self, ip, port): + pass + + @abstractmethod + async def open_connection(self): + pass + \ No newline at end of file