4 #include "ace/OS_NS_sys_socket.h"
6 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
8 // Here's the simple-minded constructor.
11 ACE_SOCK_Dgram::ACE_SOCK_Dgram ()
13 ACE_TRACE ("ACE_SOCK_Dgram::ACE_SOCK_Dgram");
17 ACE_SOCK_Dgram::~ACE_SOCK_Dgram ()
19 ACE_TRACE ("ACE_SOCK_Dgram::~ACE_SOCK_Dgram");
22 // <sendto> an N byte datagram to <addr> (connectionless version).
25 ACE_SOCK_Dgram::send (const void *buf,
30 ACE_TRACE ("ACE_SOCK_Dgram::send");
31 sockaddr *saddr = (sockaddr *) addr.get_addr ();
32 int len = addr.get_size ();
33 return ACE_OS::sendto (this->get_handle (),
37 (struct sockaddr *) saddr,
41 // <recvfrom> an n byte datagram (connectionless version).
44 ACE_SOCK_Dgram::recv (void *buf,
49 ACE_TRACE ("ACE_SOCK_Dgram::recv");
50 sockaddr *saddr = (sockaddr *) addr.get_addr ();
51 int addr_len = addr.get_size ();
53 ssize_t const status = ACE_OS::recvfrom (this->get_handle (),
59 addr.set_size (addr_len);
60 addr.set_type (saddr->sa_family);
65 ACE_SOCK_Dgram::send (const iovec buffers[],
67 size_t &number_of_bytes_sent,
70 ACE_OVERLAPPED *overlapped,
71 ACE_OVERLAPPED_COMPLETION_FUNC func) const
73 ACE_TRACE ("ACE_SOCK_Dgram::send");
74 sockaddr *saddr = (sockaddr *) addr.get_addr ();
75 int len = addr.get_size ();
76 return ACE_OS::sendto (this->get_handle (),
81 (const sockaddr *) saddr,
88 ACE_SOCK_Dgram::recv (iovec buffers[],
90 size_t &number_of_bytes_recvd,
93 ACE_OVERLAPPED *overlapped,
94 ACE_OVERLAPPED_COMPLETION_FUNC func) const
96 ACE_TRACE ("ACE_SOCK_Dgram::recv");
97 sockaddr *saddr = (sockaddr *) addr.get_addr ();
98 int addr_len = addr.get_size ();
100 ssize_t status = ACE_OS::recvfrom (this->get_handle (),
103 number_of_bytes_recvd,
109 addr.set_size (addr_len);
110 addr.set_type (saddr->sa_family);
114 // <sendto> an N byte datagram to <addr> (connectionless version).
117 ACE_SOCK_Dgram::send (const void *buf,
119 const ACE_Addr &addr,
121 ACE_OVERLAPPED *overlapped,
122 ACE_OVERLAPPED_COMPLETION_FUNC func) const
124 ACE_TRACE ("ACE_SOCK_Dgram::send");
127 buffer[0].iov_len = static_cast<u_long> (n); // Betting on < 4G
128 buffer[0].iov_base = (char *) buf;
129 size_t number_of_bytes_sent = 0;
130 return this->send (buffer,
132 number_of_bytes_sent,
139 // <recvfrom> an n byte datagram (connectionless version).
142 ACE_SOCK_Dgram::recv (void *buf,
146 ACE_OVERLAPPED *overlapped,
147 ACE_OVERLAPPED_COMPLETION_FUNC func) const
149 ACE_TRACE ("ACE_SOCK_Dgram::recv");
152 buffer[0].iov_len = static_cast<u_long> (n); // Betting on < 4G
153 buffer[0].iov_base = (char *) buf;
154 size_t number_of_bytes_recvd = 0;
155 return this->recv (buffer,
157 number_of_bytes_recvd,
164 ACE_END_VERSIONED_NAMESPACE_DECL