nos0s/common/client.py
2023-03-26 15:16:40 -04:00

25 lines
589 B
Python

import config_loader
import socket
import log
class SocketClient:
def __init__(self):
self.config = config_loader.get_config()
def start(self):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((self.config['server']['host'], self.config['server']['port']))
s.sendall(b'Hello world')
data = s.recv(1024)
log.error(f'> Received {data!r}')
#s.sendall(b'q')
def main():
log.set_lvl(log.LogLevel.DEBUG)
c = SocketClient()
c.start()
if __name__ == '__main__':
main()