AsyncUdpConnection

(Requires workerman >= 3.0.8)

AsyncUdpConnection can be used as a UDP client to communicate with a remote UDP server.

Although UDP is connectionless, for ease of use, its naming conventions and interfaces are kept consistent with AsyncTcpConnection.

Note: Unlike AsyncTcpConnection, AsyncUdpConnection does not support the following properties or methods.

  1. No connection->id property
  2. No connection->worker property
  3. No connection->transport property
  4. No connection->maxSendBufferSize property
  5. No connection->defaultMaxSendBufferSize property
  6. No connection->maxPackageSize property
  7. No connection->onBufferFull callback
  8. No connection->onBufferDrain callback
  9. No connection->onError callback
  10. No connection->destroy() interface
  11. No connection->pauseRecv() interface
  12. No connection->resumeRecv() interface
  13. No connection->pipe() interface
  14. No connection->reconnect() interface

Properties or methods supported by AsyncUdpConnection

  1. Supports connection->protocol property
  2. Supports connection->onMessage callback
  3. Supports connection->connect() method
  4. Supports connection->send() method
  5. Supports connection->getRemoteIp() method
  6. Supports connection->getRemotePort() method
  7. Supports connection->onClose callback.
    Note: Since TCP is connection-oriented, typically when either party calls close to disconnect, both parties can trigger onClose. However, since UDP is connectionless, calling the connection->close() method will only trigger the local onClose callback and cannot trigger the remote onClose callback.