1 #ifndef MSP_NET_COMMUNICATOR_H_
2 #define MSP_NET_COMMUNICATOR_H_
5 #include "streamsocket.h"
13 sigc::signal<void> signal_handshake_done;
17 const Protocol &protocol;
18 ReceiverBase &receiver;
27 Communicator(StreamSocket &, const Protocol &, ReceiverBase &);
30 void initiate_handshake();
31 bool is_handshake_done() const { return handshake_status==2; }
34 void send(const P &pkt)
36 if(handshake_status!=2)
37 throw InvalidState("Handshaking is not done");
38 unsigned size = protocol.assemble(pkt, out_buf, buf_size);
39 socket.write(out_buf, size);
43 void data_available();
44 bool receive_packet(const Protocol &, ReceiverBase &);
45 void send_handshake();