BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
362c1f4
Branches
Tags
master
Blinker
src
linux
Udp4Sock.h
update copyright header
Stefan Schuermans
commited
362c1f4
at 2019-05-04 17:17:10
Udp4Sock.h
Blame
History
Raw
/* Blinker Copyright 2011-2019 Stefan Schuermans <stefan@blinkenarea.org> Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html a blinkenarea.org project */ #ifndef UDP4SOCK_H #define UDP4SOCK_H #include <string> #include "Io.h" #include "Udp4Addr.h" namespace Blinker { /** * @brief UDP v4 socket * * UDP v4 socket in non-blocking mode with address re-usage enabled */ class Udp4Sock: public Io { public: /// constructor Udp4Sock(); /// destructor ~Udp4Sock(); private: /// copy constructor disabled Udp4Sock(const Udp4Sock &that); /// assignment operator disabled const Udp4Sock & operator=(const Udp4Sock &that); public: /** * @brief get address the socket is bound to * @param[out] addr local addess the socket is bound to * @return if local address could be obtained */ bool getAddr(Udp4Addr &addr); /** * @brief bind socket * @param[in] addr local address to bind to * @return if binding succeeded */ bool bind(const Udp4Addr &addr); /** * @brief send to socket * @param[in] data data to send in message * @param[in] addr address the message should be sent to * @return if the message could be sent */ bool send(const std::string &data, const Udp4Addr &addr); /** * @brief receive from socket * @param[out] data data in received message * @param[out] addr address the message has been received from * @return if a message has been received */ bool recv(std::string &data, Udp4Addr &addr); }; // class UdpSock } // namespace Blinker #endif // #ifndef UDP4SOCK_H