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
|
/* -*- C++ -*- */
// $Id$
// SOCK_Dgram.i
// Here's the simple-minded constructor.
inline
ACE_SOCK_Dgram::ACE_SOCK_Dgram (void)
{
ACE_TRACE ("ACE_SOCK_Dgram::ACE_SOCK_Dgram");
}
// <sendto> an N byte datagram to <addr> (connectionless version).
inline ssize_t
ACE_SOCK_Dgram::send (const void *buf,
size_t n,
const ACE_Addr &addr,
int flags) const
{
ACE_TRACE ("ACE_SOCK_Dgram::send");
sockaddr *saddr = (sockaddr *) addr.get_addr ();
size_t len = addr.get_size ();
return ACE_OS::sendto (this->get_handle (),
(const char *) buf, n, flags,
(struct sockaddr *) saddr, len);
}
// <recvfrom> an n byte datagram (connectionless version).
inline ssize_t
ACE_SOCK_Dgram::recv (void *buf,
size_t n,
ACE_Addr &addr,
int flags) const
{
ACE_TRACE ("ACE_SOCK_Dgram::recv");
sockaddr *saddr = (sockaddr *) addr.get_addr ();
int addr_len = addr.get_size ();
ssize_t status = ACE_OS::recvfrom (this->get_handle (),
(char *) buf, n, flags,
(sockaddr *) saddr, &addr_len);
addr.set_size (addr_len);
return status;
}
|