2023-03-21 21:52:27 +00:00
|
|
|
import config_loader
|
|
|
|
import socket
|
|
|
|
import log
|
|
|
|
|
2023-03-26 19:16:40 +00:00
|
|
|
class SocketClient:
|
2023-03-21 21:52:27 +00:00
|
|
|
def __init__(self):
|
|
|
|
self.config = config_loader.get_config()
|
2023-03-26 19:16:40 +00:00
|
|
|
|
|
|
|
def start(self):
|
2023-03-21 21:52:27 +00:00
|
|
|
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}')
|
2023-03-26 19:16:40 +00:00
|
|
|
#s.sendall(b'q')
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
log.set_lvl(log.LogLevel.DEBUG)
|
|
|
|
c = SocketClient()
|
|
|
|
c.start()
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|