AsyncUdpConnection
(Requires workerman>=3.0.8)
AsyncUdpConnection can be used as a udp client to communicate with remote udp server.
Actually, udp is connectionless, but for ease of use, the naming rules and interfaces are kept basically the same as AsyncTcpConnection.
Note: Unlike AsyncTcpConnection, AsyncUdpConnection does not support the following properties or methods.
- No connection->id property
- No connection->worker property
- No connection->transport property
- No connection->maxSendBufferSize property
- No connection->defaultMaxSendBufferSize property
- No connection->maxPackageSize property
- No connection->onBufferFull callback
- No connection->onBufferDrain callback
- No connection->onError callback
- No connection->destroy() method
- No connection->pauseRecv() method
- No connection->resumeRecv() method
- No connection->pipe() method
- No connection->reconnect() method
Properties or methods supported by AsyncUdpConnection
- Supports connection->protocol property
- Supports connection->onMessage callback
- Supports connection->connect() method
- Supports connection->send() method
- Supports connection->getRemoteIp() method
- Supports connection->getRemotePort() method
- Supports connection->onClose callback.
Note: Because tcp is connection-based, generally, when either side calls close to disconnect the connection, both sides can trigger onClose. But udp is connectionless, calling the connection->close() method can only trigger the local onClose callback and cannot trigger the onClose callback on the other end.