Total Complexity | 3 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import dotenv |
||
2 | import socket |
||
3 | |||
4 | from client.src.client import Client |
||
5 | from client.src.ui import App |
||
6 | |||
7 | |||
8 | def main(): |
||
9 | print("Starting Client...") |
||
10 | |||
11 | config = dotenv.dotenv_values('.env') |
||
12 | |||
13 | ip = config.get('ip') |
||
14 | if not ip: |
||
15 | print("No server address were specified.") |
||
16 | return |
||
17 | |||
18 | port = config.get('port') |
||
19 | if not port: |
||
20 | print("No server port were specified.") |
||
21 | return |
||
22 | |||
23 | client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
||
24 | |||
25 | client_socket.connect((ip, port)) |
||
26 | client_socket.setblocking(False) |
||
27 | |||
28 | app = App(Client(client_socket)) |
||
29 | |||
30 | |||
31 | if __name__ == '__main__': |
||
32 | main() |
||
33 |