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

@ -17,17 +17,16 @@ def main():
while True:
server_socket.listen()
(conn_socket, conn_addr) = server_socket.accept()
print("TCP client {} connected", conn_addr)
print(f"TCP client {conn_addr} connected")
while True:
bytes_recvd = conn_socket.recv(4096)
if len(bytes_recvd) > 0:
print(f"Received bytes from TCP client: {bytes_recvd.decode()}")
print(f"Received bytes from TCP client: {bytes_recvd}")
elif len(bytes_recvd) == 0:
break
else:
print("error receiving data from TCP client")
if SEND_PING_ONCE:
print("sending back ping")
ping_tc = PusTelecommand(service=17, subservice=1, seq_count=0, apid=APID)
conn_socket.sendall(ping_tc.pack())
SEND_PING_ONCE = False