AnCH Framework  0.1
Another C++ Hack Framework
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
udpSocket.hpp
1 /*
2  ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 standard
3  Copyright (C) 2012 Vincent Lachenal
4 
5  This file is part of ANCH Framework.
6 
7  ANCH Framework is free software: you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  ANCH Framework is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with ANCH Framework. If not, see <http://www.gnu.org/licenses/>.
19 */
20 #ifndef _ANCH_NETWORK_UDP_SOCKET_H_
21 #define _ANCH_NETWORK_UDP_SOCKET_H_
22 
23 #include "network/socket.hpp"
24 
25 
26 namespace anch {
27  namespace network {
28 
34  class UdpSocket: public Socket {
35 
36  private:
37  // Attributes +
38  // Attributes -
39 
40  public:
41  // Constructors +
45  UdpSocket();
46 
55  UdpSocket(const std::string& ipAddress, uint16_t port)
57  // Constructors -
58 
59  // Destructors +
63  virtual ~UdpSocket() noexcept;
64  // Destructors -
65 
66  public:
67  // Methods +
73  virtual void listen() throw(anch::network::IOException);
74 
81  virtual void connect() throw(anch::network::IOException);
82 
91  virtual void accept(Socket& socket) throw(anch::network::IOException);
92 
100  virtual void send(const std::string& message) throw(anch::network::IOException);
101 
110  virtual void send(const std::string& message,
111  const sockaddr_storage& peerAddr)
113 
121  virtual void receive(std::string& message) throw(anch::network::IOException);
122  // Methods -
123 
124  // Accessors +
130  virtual int getDomain() const;
131 
137  virtual int getType() const;
138  // Accessors -
139 
140  };
141 
142  }
143 }
144 
145 #endif // _ANCH_NETWORK_UDP_SOCKET_H_
virtual void receive()
Definition: socket.cpp:224
virtual int getType() const
Definition: udpSocket.cpp:188
virtual void connect()
Definition: udpSocket.cpp:96
Definition: udpSocket.hpp:34
virtual void send(const std::string &message)
Definition: udpSocket.cpp:108
AnCH framework base namespace.
Definition: base64.hpp:28
virtual void listen()
Definition: udpSocket.cpp:72
virtual ~UdpSocket() noexcept
Definition: udpSocket.cpp:59
UdpSocket()
Definition: udpSocket.cpp:38
virtual void accept(Socket &socket)
Definition: udpSocket.cpp:85
Definition: socket.hpp:93
Definition: ioException.hpp:34
virtual int getDomain() const
Definition: udpSocket.cpp:178