Commit 22116217 authored by Moritz Sokoll's avatar Moritz Sokoll 💬
Browse files

Inital commit

# Bird Messenger
## an open source messaging system including protocol
import socket
class ServerException(Exception):
class Server:
def __init__(self, host:str, port:int):
self.socket = socket.socket(socket.AF_INET, socket.SOCKSTREAM)
self.connarray = [] = host
self.port = port
def __repr__(self):
return f"message Server on: {}:{self.port}"
def serve(self):
self.socket.bind((, self.port))
raise ServerException("failed to bind socket")
while True:
conn, addr = self.socket.accept()
size = int(conn.recv(64).decode())
rawmsg = conn.recv(size).decode()
paramarray = rawmsg.split("\n")
paramdict = {}
for i in paramarray:
paramdict[i.strip().split(":")[0]] = i.strip().split(":")[1]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment