![]() |
AnCH Framework
0.1
Another C++ Hack Framework
|
#include <udpSocket.hpp>
Public Member Functions | |
UdpSocket () | |
UdpSocket (const std::string &ipAddress, uint16_t port) throw (anch::network::IOException) | |
virtual | ~UdpSocket () noexcept |
virtual void | listen () throw (anch::network::IOException) |
virtual void | connect () throw (anch::network::IOException) |
virtual void | accept (Socket &socket) throw (anch::network::IOException) |
virtual void | send (const std::string &message) throw (anch::network::IOException) |
virtual void | send (const std::string &message, const sockaddr_storage &peerAddr) throw (anch::network::IOException) |
virtual void | receive (std::string &message) throw (anch::network::IOException) |
virtual int | getDomain () const |
virtual int | getType () const |
![]() | |
Socket (const std::string &ipAddress, uint16_t port, anch::network::SocketType type=anch::network::SocketType::UNKNOWN) throw (anch::network::IOException) | |
virtual | ~Socket () noexcept |
virtual void | bind () throw (anch::network::IOException) |
virtual void | receive () throw (anch::network::IOException) |
virtual void | shutdown (anch::network::Direction how=anch::network::Direction::BOTH) throw (anch::network::IOException) |
virtual void | close () noexcept |
const std::string & | getIpAddress () const |
void | setIpAddress (const std::string &ipAddress) |
uint16_t | getPort () const |
void | setIpAddress (uint16_t port) |
anch::network::SocketType | getSocketType () const |
void | setSocketType (SocketType type) |
int | getBacklog () const |
void | setBacklog (int backlog) |
![]() | |
Observable () | |
virtual | ~Observable () |
bool | addObserver (anch::events::Observer< anch::network::SocketEvent > &observer) |
void | removeObserver (anch::events::Observer< anch::network::SocketEvent > &observer) |
void | notifyObservers (const anch::network::SocketEvent &event) |
Additional Inherited Members | |
![]() | |
Socket (anch::network::SocketType type) | |
![]() | |
SOCKET | _sock |
int | _backlog |
addrinfo * | _address |
UDP socket implementation
UdpSocket::UdpSocket | ( | ) |
UdpSocket default constructor
UdpSocket::UdpSocket | ( | const std::string & | ipAddress, |
uint16_t | port | ||
) | |||
throw | ( | anch::network::IOException | |
) |
UdpSocket constructor
ipAddress | The IP address |
port | The port number |
anch::network::IOException | Error while creating the socket |
UdpSocket constructor
ipAddress | The IP address |
port | The port number |
|
virtual |
Accept client connection.
This method do nothing since UDP is not connected
socket | The socket which describes client connection |
anch::network::IOException | Never on UDP socket |
Reimplemented from anch::network::Socket.
|
virtual |
Connect to remote socket.
This method do nothing since UDP is not connected.
anch::network::IOException | Never on UDP socket |
Reimplemented from anch::network::Socket.
|
virtual |
|
virtual |
|
virtual |
Listen on socket
anch::network::IOException | Error while listening on the socket |
Reimplemented from anch::network::Socket.
|
virtual |
Receive a message on socket
message | The string where to write the message |
anch::network::IOException | Network error while receiving message |
Implements anch::network::Socket.
|
virtual |
Send a message on socket
message | The message to send |
anch::network::IOException | Network error while sending message |
Implements anch::network::Socket.
|
virtual |
Send a message on socket
message | The message to send |
peerAddr | The address where the message has to be sent |
anch::network::IOException | Network error while sending message |
Send a message on socket
message | The message to send |
anch::network::IOException | Network error while sending message |