scclib
Stable Cloud Computing C++ Library
Public Member Functions | Protected Member Functions | List of all members
scc::net::UdpSocket Class Referenceabstract

Udp socket base class. More...

#include <socket.h>

Inheritance diagram for scc::net::UdpSocket:
Inheritance graph
[legend]
Collaboration diagram for scc::net::UdpSocket:
Collaboration graph
[legend]

Public Member Functions

virtual void reset ()=0
 
size_t recv (void *loc, size_t len, SockaddrBase &s)
 Receive bytes (a datagram), setting the socket address of the peer. More...
 
size_t recv (void *loc, size_t len, SockaddrBase &s, std::error_code &e) noexcept
 Receive bytes (a datagram), setting the socket address of the peer, and the error code. More...
 
size_t send (const void *loc, size_t len, const SockaddrBase &d)
 Send bytes (a datagram) to a peer address. More...
 
size_t send (const void *loc, size_t len, const SockaddrBase &d, std::error_code &e) noexcept
 Send bytes (a datagram) to a peer address, setting the error code. More...
 
size_t recv_next ()
 Return the number of bytes available to read (the size of the next datagram).
 
- Public Member Functions inherited from scc::net::SocketBase
 SocketBase (SocketBase &&other)
 Move construct socket.
 
const SocketBaseoperator= (SocketBase &&other)
 Move assign socket.
 
int fd () const
 Return the underlying socket handle.
 
 operator int () const
 Allow object to be cast to a socket handle.
 
void reuse_addr (bool r=true)
 Set address reusable. More...
 
void reuse_port (bool r=true)
 Set port reusable. More...
 
void non_blocking (bool b=true)
 Set the socket non-blocking. More...
 
std::error_code error_code ()
 Get the current error code (status). More...
 
void recv_bufsize (unsigned)
 Set receive buffer size. More...
 
unsigned recv_bufsize ()
 Get total receive buffer size including overhead.
 
void send_bufsize (unsigned)
 Set send buffer size. More...
 
unsigned send_bufsize ()
 Get total send buffer size including overhead.
 
void send_timeout (std::chrono::milliseconds)
 Set the send timeout. More...
 
void recv_timeout (std::chrono::milliseconds)
 Set the receive timeout. More...
 
void bind (const SockaddrBase &)
 Bind an address to the socket.
 
size_t recv (void *loc, size_t len)
 Receive bytes, throwing an exception on error. More...
 
size_t recv (void *loc, size_t len, std::error_code &e) noexcept
 Receive bytes. More...
 
size_t send (const void *loc, size_t len)
 Send bytes, throwing an exception on error. More...
 
size_t send (const void *loc, size_t len, std::error_code &e) noexcept
 Send bytes, setting the error code for the call. More...
 
void close ()
 Close the socket.
 

Protected Member Functions

 UdpSocket (int, int, int)
 
- Protected Member Functions inherited from scc::net::SocketBase
 SocketBase (int fd)
 
 SocketBase (int, int, int)
 
void reset (int, int, int)
 
void move (SocketBase &other)
 
void get_sockaddr (sockaddr &)
 

Detailed Description

Udp socket base class.

Definition at line 348 of file socket.h.

Member Function Documentation

◆ recv() [1/2]

size_t UdpSocket::recv ( void *  loc,
size_t  len,
SockaddrBase s 
)

Receive bytes (a datagram), setting the socket address of the peer.

/see Socket::recv

Definition at line 453 of file socket.cc.

◆ recv() [2/2]

size_t UdpSocket::recv ( void *  loc,
size_t  len,
SockaddrBase s,
std::error_code &  e 
)
noexcept

Receive bytes (a datagram), setting the socket address of the peer, and the error code.

/see Socket::recv

Definition at line 427 of file socket.cc.

◆ send() [1/2]

size_t UdpSocket::send ( const void *  loc,
size_t  len,
const SockaddrBase d 
)

Send bytes (a datagram) to a peer address.

/see Socket::send

Definition at line 486 of file socket.cc.

◆ send() [2/2]

size_t UdpSocket::send ( const void *  loc,
size_t  len,
const SockaddrBase d,
std::error_code &  e 
)
noexcept

Send bytes (a datagram) to a peer address, setting the error code.

/see Socket::send

Definition at line 466 of file socket.cc.


The documentation for this class was generated from the following files: