Skip to content

Commit

Permalink
Begun socket client write down (no code yet, mostly doe the structure…
Browse files Browse the repository at this point in the history
… on paper up to now)
  • Loading branch information
Sbef98 committed Feb 9, 2022
1 parent 9058181 commit 6a6f881
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"python.linting.flake8Enabled": true,
"python.linting.enabled": true
"python.linting.enabled": true,
"python.analysis.extraPaths": [
"./bridge/data",
"./bridge/data"
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions Sender protocols/SocketProtocol.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from typing import Protocol
import protocol


class SocketCom:
"""
SocketCom is the single socket communication
"""
def __init__(self, remoteServer, port, beginTrigger=b'\xff', endTrigger=b'\xfe'):
inBuffer = Protocol(beginTrigger, endTrigger)


class ControllerFactory:
"""
It's our "Controller loop" in sockets.
It may be useful having a controller loop for the socket
communication too so that we can create SocketComs like a
factory pattern.
Why doing so?
If we need an high-throughput, we can
"""

def __init__(self, remoteServer, portRange=[8000, 9000]):
"""
portRange is useful in case i want to decide on which ports
range i want my sockets to work on!
"""
pass
2 changes: 1 addition & 1 deletion bridge/handler/message_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,4 @@ def write(self, bytesToSend, device_id=None):

if __name__ == "__main__":
hand = SocketHandler(None, 8080, "localhost")
SocketHandler.loop()
SocketHandler.loop()

0 comments on commit 6a6f881

Please sign in to comment.