00001
00002
00003
00004
00005
00006
00007
00008
00009 static const char rcsid[] __attribute__((used)) = "$Id: UDPSocket.cpp 1197 2014-10-14 22:26:11Z sella $";
00010
00011 #include "UDPSocket.h"
00012
00013 #include <sys/types.h>
00014 #include <sys/socket.h>
00015 #include <string.h>
00016
00017 using namespace sella::net;
00018
00019 UDPSocket::UDPSocket(int family) throw (SocketException) : Socket(family, SOCK_DGRAM, IPPROTO_UDP) {
00020 }
00021
00022 UDPSocket::UDPSocket(int family, const IPAddressPort &addressport) throw (SocketException) : Socket(family, SOCK_DGRAM, IPPROTO_UDP) {
00023 connect(addressport);
00024 }
00025
00026 UDPSocket::UDPSocket(int family, const IPAddress &address, const Port &port) throw (SocketException) : Socket(family, SOCK_DGRAM, IPPROTO_UDP) {
00027 connect(address, port);
00028 }
00029
00030 UDPSocket::UDPSocket(int family, const std::string &address, unsigned short port) throw (SocketException) : Socket(family, SOCK_DGRAM, IPPROTO_UDP) {
00031 connect(address, port);
00032 }
00033
00034 UDPSocket::UDPSocket(const IPAddressPort &addressport) throw (SocketException) : Socket(addressport.getFamily(), SOCK_DGRAM, IPPROTO_UDP) {
00035 connect(addressport);
00036 }
00037
00038 UDPSocket::UDPSocket(const IPAddress &address, const Port &port) throw (SocketException) : Socket(address.getFamily(), SOCK_DGRAM, IPPROTO_UDP) {
00039 connect(address, port);
00040 }
00041
00042 UDPSocket::~UDPSocket() {
00043 }
00044
00045 const UDPSocket::shared UDPSocket::shared_ptr(int family) throw (SocketException) {
00046 return std::make_shared<UDPSocket>(family);
00047 }
00048
00049 const UDPSocket::shared UDPSocket::shared_ptr(int family, const IPAddressPort &addressport) throw (SocketException) {
00050 return std::make_shared<UDPSocket>(family, addressport);
00051 }
00052
00053 const UDPSocket::shared UDPSocket::shared_ptr(int family, const IPAddress &address, const Port &port) throw (SocketException) {
00054 return std::make_shared<UDPSocket>(family, address, port);
00055 }
00056
00057 const UDPSocket::shared UDPSocket::shared_ptr(int family, const std::string &address, unsigned short port) throw (SocketException) {
00058 return std::make_shared<UDPSocket>(family, address, port);
00059 }
00060
00061
00062
00063