| MistServer
    2.5.3-Pro-19-gf5e75b1 ( Generic_64)
    | 
#include <socket.h>
| Public Member Functions | |
| UDPConnection (const UDPConnection &o) | |
| Copies a UDP socket, re-allocating local copies of any needed structures.  More... | |
| UDPConnection (const UDPConnection &o) | |
| UDPConnection (bool nonblock=false) | |
| Create a new UDP Socket.  More... | |
| UDPConnection (bool nonblock=false) | |
| ~UDPConnection () | |
| Closes the UDP socket, cleans up any memory allocated by the socket.  More... | |
| ~UDPConnection () | |
| int | bind (int port, std::string iface="", const std::string &multicastAddress="") | 
| int | bind (int port, std::string iface="", const std::string &multicastAddress="") | 
| Bind to a port number, returning the bound port.  More... | |
| void | GetDestination (std::string &hostname, uint32_t &port) | 
| Gets the properties of the receiving end of this UDP socket.  More... | |
| void | GetDestination (std::string &hostname, uint32_t &port) | 
| int | getSock () | 
| int | getSock () | 
| bool | Receive () | 
| Attempt to receive a UDP packet.  More... | |
| bool | Receive () | 
| void | SendNow (const std::string &data) | 
| void | SendNow (const std::string &data) | 
| Sends a UDP datagram using the buffer sdata.  More... | |
| void | SendNow (const char *data) | 
| void | SendNow (const char *data) | 
| Sends a UDP datagram using the buffer sdata.  More... | |
| void | SendNow (const char *data, size_t len) | 
| Sends a UDP datagram using the buffer sdata of length len.  More... | |
| void | SendNow (const char *data, size_t len) | 
| void | setBlocking (bool blocking) | 
| Sets the socket to be blocking if the parameters is true.  More... | |
| void | setBlocking (bool blocking) | 
| void | SetDestination (std::string hostname, uint32_t port) | 
| void | SetDestination (std::string hostname, uint32_t port) | 
| Stores the properties of the receiving end of this UDP socket.  More... | |
| Data Fields | |
| char * | data | 
| Holds the last received packet.  More... | |
| unsigned int | data_len | 
| The size in bytes of the last received packet.  More... | |
| Private Attributes | |
| unsigned int | data_size | 
| The size in bytes of the allocated space in the data pointer.  More... | |
| void * | destAddr | 
| Destination address pointer.  More... | |
| unsigned int | destAddr_size | 
| Size of the destination address pointer.  More... | |
| unsigned int | down | 
| Amount of bytes transferred down.  More... | |
| bool | isIPv6 | 
| std::string | remotehost | 
| Stores remote host address.  More... | |
| int | sock | 
| Internally saved socket number.  More... | |
| unsigned int | up | 
| Amount of bytes transferred up.  More... | |
| Socket::UDPConnection::UDPConnection | ( | const UDPConnection & | o | ) | 
Copies a UDP socket, re-allocating local copies of any needed structures.
The data/data_size/data_len variables are not copied over.
| Socket::UDPConnection::UDPConnection | ( | bool | nonblock = false | ) | 
Create a new UDP Socket.
Will attempt to create an IPv6 UDP socket, on fail try a IPV4 UDP socket. If both fail, prints an DLVL_FAIL debug message.
| nonblock | Whether the socket should be nonblocking. | 
| Socket::UDPConnection::~UDPConnection | ( | ) | 
Closes the UDP socket, cleans up any memory allocated by the socket.
| Socket::UDPConnection::UDPConnection | ( | const UDPConnection & | o | ) | 
| Socket::UDPConnection::UDPConnection | ( | bool | nonblock = false | ) | 
| Socket::UDPConnection::~UDPConnection | ( | ) | 
| int Socket::UDPConnection::bind | ( | int | port, | 
| std::string | iface = "", | ||
| const std::string & | multicastInterfaces = "" | ||
| ) | 
Bind to a port number, returning the bound port.
Attempts to bind over IPv6 first. If it fails, attempts to bind over IPv4. If that fails too, gives up and returns zero. Prints a debug message at DLVL_FAIL level if binding failed.
| int Socket::UDPConnection::bind | ( | int | port, | 
| std::string | iface = "", | ||
| const std::string & | multicastAddress = "" | ||
| ) | 
| void Socket::UDPConnection::GetDestination | ( | std::string & | destIp, | 
| uint32_t & | port | ||
| ) | 
Gets the properties of the receiving end of this UDP socket.
This will be the receiving end for all SendNow calls.
| void Socket::UDPConnection::GetDestination | ( | std::string & | hostname, | 
| uint32_t & | port | ||
| ) | 
| int Socket::UDPConnection::getSock | ( | ) | 
| int Socket::UDPConnection::getSock | ( | ) | 
| bool Socket::UDPConnection::Receive | ( | ) | 
Attempt to receive a UDP packet.
This will automatically allocate or resize the internal data buffer if needed. If a packet is received, it will be placed in the "data" member, with it's length in "data_len".
| bool Socket::UDPConnection::Receive | ( | ) | 
| void Socket::UDPConnection::SendNow | ( | const std::string & | sdata | ) | 
Sends a UDP datagram using the buffer sdata.
This function simply calls SendNow(const char*, size_t)
| void Socket::UDPConnection::SendNow | ( | const std::string & | data | ) | 
| void Socket::UDPConnection::SendNow | ( | const char * | sdata | ) | 
Sends a UDP datagram using the buffer sdata.
sdata is required to be NULL-terminated. This function simply calls SendNow(const char*, size_t)
| void Socket::UDPConnection::SendNow | ( | const char * | data | ) | 
| void Socket::UDPConnection::SendNow | ( | const char * | data, | 
| size_t | len | ||
| ) | 
| void Socket::UDPConnection::SendNow | ( | const char * | sdata, | 
| size_t | len | ||
| ) | 
Sends a UDP datagram using the buffer sdata of length len.
Does not do anything if len < 1. Prints an DLVL_FAIL level debug message if sending failed.
| void Socket::UDPConnection::setBlocking | ( | bool | blocking | ) | 
Sets the socket to be blocking if the parameters is true.
Sets the socket to be non-blocking otherwise.
| void Socket::UDPConnection::setBlocking | ( | bool | blocking | ) | 
| void Socket::UDPConnection::SetDestination | ( | std::string | destIp, | 
| uint32_t | port | ||
| ) | 
Stores the properties of the receiving end of this UDP socket.
This will be the receiving end for all SendNow calls.
| void Socket::UDPConnection::SetDestination | ( | std::string | hostname, | 
| uint32_t | port | ||
| ) | 
| char * Socket::UDPConnection::data | 
Holds the last received packet.
| unsigned int Socket::UDPConnection::data_len | 
The size in bytes of the last received packet.
| 
 | private | 
The size in bytes of the allocated space in the data pointer.
| 
 | private | 
Destination address pointer.
| 
 | private | 
Size of the destination address pointer.
| 
 | private | 
Amount of bytes transferred down.
| 
 | private | 
| 
 | private | 
Stores remote host address.
| 
 | private | 
Internally saved socket number.
| 
 | private | 
Amount of bytes transferred up.
 1.8.11
 1.8.11