fawkes::FawkesNetworkTransceiver Class Reference
[Fawkes Network Communication]
Fawkes Network Transceiver.
More...
#include <netcomm/fawkes/transceiver.h>
Static Public Member Functions | |
| static void | send (StreamSocket *s, FawkesNetworkMessageQueue *msgq) |
| Send messages. | |
| static void | recv (StreamSocket *s, FawkesNetworkMessageQueue *msgq, unsigned int max_num_msgs=8) |
| Receive data. | |
Detailed Description
Fawkes Network Transceiver.Utility class that provides methods to send and receive messages via the network. Operates on message queues and a given socket.
Definition at line 34 of file transceiver.h.
Member Function Documentation
| void fawkes::FawkesNetworkTransceiver::recv | ( | StreamSocket * | s, | |
| FawkesNetworkMessageQueue * | msgq, | |||
| unsigned int | max_num_msgs = 8 | |||
| ) | [static] |
Receive data.
This method receives all messages currently available from the network, or a limited number depending on max_num_msgs. If max_num_msgs is 0 then all messages are read. Note that on a busy connection this may cause recv() to never return! The default is to return after 8 messages. The messages are stored in the supplied message queue.
- Parameters:
-
s socket to gather messages from msgq message queue to store received messages in max_num_msgs maximum number of messages to read from stream in one go.
- Exceptions:
-
ConnectionDiedException Thrown if any error occurs during the operation since for any error the conncetion is considered dead.
Definition at line 86 of file transceiver.cpp.
References fawkes::Socket::available(), fawkes::fawkes_message_t::header, fawkes::LockQueue< Type >::lock(), fawkes::fawkes_message_t::payload, fawkes::fawkes_message_header_t::payload_size, fawkes::Socket::read(), and fawkes::LockQueue< Type >::unlock().
| void fawkes::FawkesNetworkTransceiver::send | ( | StreamSocket * | s, | |
| FawkesNetworkMessageQueue * | msgq | |||
| ) | [static] |
Send messages.
- Parameters:
-
s socket over which the data shall be transmitted. msgq message queue that contains the messages that have to be sent
- Exceptions:
-
ConnectionDiedException Thrown if any error occurs during the operation since for any error the conncetion is considered dead.
Definition at line 51 of file transceiver.cpp.
References fawkes::FawkesNetworkMessage::fmsg(), fawkes::fawkes_message_t::header, fawkes::LockQueue< Type >::lock(), fawkes::FawkesNetworkMessage::pack(), fawkes::fawkes_message_t::payload, fawkes::FawkesNetworkMessage::payload_size(), fawkes::LockQueue< Type >::unlock(), fawkes::RefCount::unref(), and fawkes::Socket::write().
Referenced by fawkes::FawkesNetworkServerClientSendThread::loop(), and fawkes::FawkesNetworkClientSendThread::loop().
The documentation for this class was generated from the following files:
- src/libs/netcomm/fawkes/transceiver.h
- src/libs/netcomm/fawkes/transceiver.cpp

