1 // 2 // Copyright (c) 2010-2024 Antmicro 3 // 4 // This file is licensed under the MIT License. 5 // Full license text is available in 'licenses/MIT.txt'. 6 // 7 #ifndef SOCKET_CHANNEL_H 8 #define SOCKET_CHANNEL_H 9 #include "communication_channel.h" 10 #include "../../libs/socket-cpp/Socket/TCPClient.h" 11 12 class SocketCommunicationChannel : public CommunicationChannel 13 { 14 public: 15 SocketCommunicationChannel(); 16 void connect(int receiverPort, int senderPort, const char* address); 17 void disconnect(); 18 bool isConnected() override; 19 void handshakeValid(); 20 void log(int logLevel, const char* data) override; 21 Protocol* receive() override; 22 void sendMain(const Protocol message) override; 23 void sendSender(const Protocol message) override; 24 25 private: 26 bool connected; 27 std::unique_ptr<CTCPClient> mainSocket; 28 std::unique_ptr<CTCPClient> senderSocket; 29 }; 30 31 #endif 32