9 static const char rcsid[] __attribute__((used)) =
"$Id: UDPSocket.cpp 1653 2016-02-28 19:54:59Z sella $";
11 #include "UDPSocket.h"
13 #include <sys/types.h>
14 #include <sys/socket.h>
17 using namespace sella::net;
19 UDPSocket::UDPSocket(
int family)
throw (SocketException) :
Socket(family, SOCK_DGRAM, IPPROTO_UDP) {
22 UDPSocket::UDPSocket(
int family,
const IPAddressPort &addressport)
throw (SocketException) :
Socket(family, SOCK_DGRAM, IPPROTO_UDP) {
26 UDPSocket::UDPSocket(
int family,
const IPAddress &address,
const Port &port)
throw (SocketException) :
Socket(family, SOCK_DGRAM, IPPROTO_UDP) {
27 connect(address, port);
30 UDPSocket::UDPSocket(
int family,
const std::string &address,
unsigned short port)
throw (SocketException) :
Socket(family, SOCK_DGRAM, IPPROTO_UDP) {
31 connect(address, port);
34 UDPSocket::UDPSocket(
const IPAddressPort &addressport)
throw (SocketException) :
Socket(addressport.getFamily(), SOCK_DGRAM, IPPROTO_UDP) {
38 UDPSocket::UDPSocket(
const IPAddress &address,
const Port &port)
throw (SocketException) :
Socket(address.getFamily(), SOCK_DGRAM, IPPROTO_UDP) {
39 connect(address, port);
42 UDPSocket::~UDPSocket() {
45 const UDPSocket::shared UDPSocket::shared_ptr(
int family)
throw (SocketException) {
46 return std::make_shared<UDPSocket>(family);
49 const UDPSocket::shared UDPSocket::shared_ptr(
int family,
const IPAddressPort &addressport)
throw (SocketException) {
50 return std::make_shared<UDPSocket>(family, addressport);
53 const UDPSocket::shared UDPSocket::shared_ptr(
int family,
const IPAddress &address,
const Port &port)
throw (SocketException) {
54 return std::make_shared<UDPSocket>(family, address, port);
57 const UDPSocket::shared UDPSocket::shared_ptr(
int family,
const std::string &address,
unsigned short port)
throw (SocketException) {
58 return std::make_shared<UDPSocket>(family, address, port);