9 #ifndef CPPSERVER_NANOMSG_SURVEY_SERVER_H 10 #define CPPSERVER_NANOMSG_SURVEY_SERVER_H 37 explicit SurveyServer(
const std::string& address,
int deadline = 1000)
77 #endif // CPPSERVER_NANOMSG_SURVEY_SERVER_H SurveyServer & operator=(const SurveyServer &)=delete
bool SetSocketOption(int level, int option, const void *value, size_t size)
Set the socket option.
size_t TryReceive(Message &message)
Try to receive a message from the client in non-blocking mode.
Socket & socket() noexcept
Get the Nanomsg socket.
C++ Server project definitions.
std::tuple< size_t, bool > ReceiveSurvey(Message &message)
Receive a respond to the survey from the clients in non-blocking mode.
virtual void onThreadCleanup()
Cleanup thread handler.
virtual void onIdle()
Handle server idle notification.
virtual void onThreadInitialize()
Initialize thread handler.
Nanomsg server definition.
Used to send the survey. The survey is delivered to all the connected respondents.
virtual void onReceived(Message &message)
Handle message received notification.
Protocol
Nanomsg protocol.
virtual ~SurveyServer()=default
size_t Receive(Message &message)
Receive a message from the client.
Standard full-blown socket.
std::tuple< size_t, bool > TryReceiveSurvey(Message &message)
Try to receive a respond to the survey from the clients in non-blocking mode.
SurveyServer(const std::string &address, int deadline=1000)
Initialize server with a given endpoint address.