continue networking code

This commit is contained in:
2024-04-18 18:38:50 +02:00
parent b362e05280
commit c510df3154
4 changed files with 16 additions and 12 deletions

View File

@ -1,5 +1,6 @@
from typing import Any, Optional
import socket
import logging
from threading import Thread, Event, Lock
from collections import deque
@ -7,6 +8,9 @@ from tmtccmd.com import ComInterface
from tmtccmd.tmtc import TelemetryListT
_LOGGER = logging.getLogger(__name__)
class TcpServer(ComInterface):
def __init__(self, port: int):
self.port = port
@ -56,7 +60,7 @@ class TcpServer(ComInterface):
while True and not self._kill_signal.is_set():
self._server_socket.listen()
(conn_socket, conn_addr) = self._server_socket.accept()
print("TCP client {} connected", conn_addr)
_LOGGER.info("TCP client {} connected", conn_addr)
while True:
bytes_recvd = conn_socket.recv(4096)
if len(bytes_recvd) > 0: