blob: 9b86ebe6119399f3a8fb48969e44d6d2d269fc51 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
//
// DatagramSocketImpl.cpp
//
// Library: Net
// Package: Sockets
// Module: DatagramSocketImpl
//
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#include "Poco/Net/DatagramSocketImpl.h"
#include "Poco/Net/NetException.h"
using Poco::InvalidArgumentException;
namespace Poco {
namespace Net {
DatagramSocketImpl::DatagramSocketImpl()
{
}
DatagramSocketImpl::DatagramSocketImpl(SocketAddress::Family family)
{
if (family == SocketAddress::IPv4)
init(AF_INET);
#if defined(POCO_HAVE_IPv6)
else if (family == SocketAddress::IPv6)
init(AF_INET6);
#endif
#if defined(POCO_OS_FAMILY_UNIX)
else if (family == SocketAddress::UNIX_LOCAL)
init(AF_UNIX);
#endif
else throw InvalidArgumentException("Invalid or unsupported address family passed to DatagramSocketImpl");
}
DatagramSocketImpl::DatagramSocketImpl(poco_socket_t sockfd): SocketImpl(sockfd)
{
}
DatagramSocketImpl::~DatagramSocketImpl()
{
}
void DatagramSocketImpl::init(int af)
{
initSocket(af, SOCK_DGRAM);
}
} } // namespace Poco::Net
|