UDP socket backed by Poco::Net; supports connect/bind and datagram send. 更多...
#include <UdpSocket.h>
Public 成员函数 | |
| UdpSocket (Network *net) | |
| Creates an unbound socket owned by the given module. | |
| ~UdpSocket () | |
| bool | bind (uint16_t port) |
| Binds to a local port; true on success. | |
| bool | connect (std::string host, uint16_t port) |
| Connects to a remote host:port (restricts send()). | |
| bool | sendTo (eve::data::ByteData *data, std::string host, uint16_t port) |
| Sends a datagram to an explicit host:port. | |
| bool | sendToString (std::string s, std::string host, uint16_t port) |
| Sends a string datagram to an explicit host:port. | |
| bool | send (eve::data::ByteData *data) |
| Sends a datagram to the connected peer. | |
| bool | sendString (std::string s) |
| Sends a string datagram to the connected peer. | |
| void | close () |
| Closes the socket. | |
| Poco::Net::DatagramSocket * | datagram () |
| Internal: underlying Poco datagram socket. | |
| bool | isBound () const |
| True after bind(). | |
| Network * | network () const |
| Owning module. | |
详细描述
UDP socket backed by Poco::Net; supports connect/bind and datagram send.
在文件 UdpSocket.h 第 24 行定义.
构造及析构函数说明
◆ UdpSocket()
|
explicit |
Creates an unbound socket owned by the given module.
在文件 UdpSocket.cpp 第 12 行定义.
◆ ~UdpSocket()
| eve::network::UdpSocket::~UdpSocket | ( | ) |
在文件 UdpSocket.cpp 第 14 行定义.
引用了 close().
成员函数说明
◆ bind()
| bool eve::network::UdpSocket::bind | ( | uint16_t | port | ) |
Binds to a local port; true on success.
在文件 UdpSocket.cpp 第 22 行定义.
引用了 c, eve::network::Err, eve::network::Network::post(), eve::network::NetCompletion::type, eve::network::Udp , 以及 eve::network::Network::watchUdp().
被这些函数引用 eve::network::NetHost::start().
◆ close()
| void eve::network::UdpSocket::close | ( | ) |
Closes the socket.
在文件 UdpSocket.cpp 第 129 行定义.
引用了 eve::network::Network::unwatchUdp().
被这些函数引用 ~UdpSocket().
◆ connect()
| bool eve::network::UdpSocket::connect | ( | std::string | host, |
| uint16_t | port | ||
| ) |
Connects to a remote host:port (restricts send()).
在文件 UdpSocket.cpp 第 47 行定义.
引用了 c, eve::network::Err, eve::network::Network::post(), eve::network::NetCompletion::type, eve::network::Udp , 以及 eve::network::Network::watchUdp().
◆ datagram()
| Poco::Net::DatagramSocket * eve::network::UdpSocket::datagram | ( | ) |
Internal: underlying Poco datagram socket.
在文件 UdpSocket.cpp 第 18 行定义.
◆ isBound()
|
inline |
True after bind().
在文件 UdpSocket.h 第 48 行定义.
◆ network()
|
inline |
Owning module.
在文件 UdpSocket.h 第 50 行定义.
◆ send()
| bool eve::network::UdpSocket::send | ( | eve::data::ByteData * | data | ) |
Sends a datagram to the connected peer.
在文件 UdpSocket.cpp 第 100 行定义.
引用了 c, data, eve::network::Err, n, eve::network::NetWorker::submit(), eve::network::NetCompletion::type, eve::network::Udp , 以及 eve::network::Network::worker().
被这些函数引用 sendString().
◆ sendString()
| bool eve::network::UdpSocket::sendString | ( | std::string | s | ) |
Sends a string datagram to the connected peer.
在文件 UdpSocket.cpp 第 123 行定义.
◆ sendTo()
| bool eve::network::UdpSocket::sendTo | ( | eve::data::ByteData * | data, |
| std::string | host, | ||
| uint16_t | port | ||
| ) |
Sends a datagram to an explicit host:port.
在文件 UdpSocket.cpp 第 70 行定义.
引用了 c, data, eve::network::Err, n, eve::network::NetWorker::submit(), eve::network::NetCompletion::type, eve::network::Udp , 以及 eve::network::Network::worker().
被这些函数引用 sendToString().
◆ sendToString()
| bool eve::network::UdpSocket::sendToString | ( | std::string | s, |
| std::string | host, | ||
| uint16_t | port | ||
| ) |
Sends a string datagram to an explicit host:port.
在文件 UdpSocket.cpp 第 94 行定义.
该类的文档由以下文件生成:
- src/modules/network/UdpSocket.h
- src/modules/network/UdpSocket.cpp