Initial TCP server

This commit is contained in:
2025-06-05 01:44:58 -04:00
parent 6abf6be32d
commit e87abf9eef
18 changed files with 373 additions and 90 deletions

View File

@@ -5,15 +5,34 @@
#ifndef TCPSERVER_H
#define TCPSERVER_H
#include <vector>
#include <unordered_set>
#include "freertos/FreeRTOS.h"
#include "IRPCServer.h"
class TCPServer : IRPCServer {
public:
TCPServer();
~TCPServer();
explicit TCPServer(int port);
~TCPServer();
private:
bool authenticate_client(int client_sock);
}
static bool is_network_connected();
[[noreturn]] static void tcp_server_task(void *args);
[[noreturn]] static void socket_monitor_thread(void *args);
int m_port;
int m_server_sock;
TaskHandle_t m_task;
TaskHandle_t m_rx_task;
TaskHandle_t m_tx_task;
SemaphoreHandle_t m_mutex;
std::unordered_set<int> m_clients;
};
#endif //TCPSERVER_H