NetworkUdpServerInterface Class Reference

#include <network_ip_udp.h>

Inheritance diagram for NetworkUdpServerInterface:

Detailed Description

An asynchronous UDP server.

Public Types

using ReceiveCompletionHandler = NetworkUdpChannelInterface::ReceiveCompletionHandler
 
using SendCompletionHandler = NetworkUdpChannelInterface::SendCompletionHandler
 

Public Member Functions

MAXON_METHOD Result< void > Start ()
 
MAXON_METHOD void Stop ()
 
MAXON_METHOD Bool IsStopped () const
 
MAXON_METHOD Result< void > Send (const AioStatusRef &status, AioBuffer data, const NetworkIpAddrPort &destAddress, SendCompletionHandler handler=NetworkUdpChannelInterface::DefaultSendCompletionHandler)
 
MAXON_METHOD Result< void > Send (AioBuffer data, const NetworkIpAddrPort &destAddress, SendCompletionHandler handler=NetworkUdpChannelInterface::DefaultSendCompletionHandler)
 
MAXON_METHOD AioServiceRef GetIoService () const
 
MAXON_METHOD JobQueueRef GetJobQueue () const
 

Private Member Functions

 MAXON_INTERFACE (NetworkUdpServerInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.networkudpserver")
 
- Private Member Functions inherited from AioReaderInterface
MAXON_METHOD Result< void > NotifyForRead (SocketT sockfd, Result< void > result)
 
- Private Member Functions inherited from AioWriterInterface
MAXON_METHOD Result< void > NotifyForWrite (SocketT sockfd, Result< void > result)
 

Member Typedef Documentation

◆ ReceiveCompletionHandler

◆ SendCompletionHandler

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( NetworkUdpServerInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.interface.networkudpserver"   
)
private

◆ Start()

MAXON_METHOD Result<void> Start ( )

Starts the server. Returns an error if the server was already started, or if it failed to set up a listening socket. After the server is successfully started, it will receive incoming packets.

◆ Stop()

MAXON_METHOD void Stop ( )

Stops the server. Afterwards the server no longer accepts incoming connections.

◆ IsStopped()

MAXON_METHOD Bool IsStopped ( ) const

Returns true if the server is not started.

◆ Send() [1/2]

MAXON_METHOD Result<void> Send ( const AioStatusRef &  status,
AioBuffer  data,
const NetworkIpAddrPort destAddress,
SendCompletionHandler  handler = NetworkUdpChannelInterface::DefaultSendCompletionHandler 
)

Enqueues an asynchronous send request. As soon as data has been sent, the given handler delegate is called. A status instance can be used to synchronously wait on the operation and check its success.

Parameters
[in]statusStatus monitor for the operation.
[in]dataBuffer containing data to be sent.
[in]destAddressDestination address.
[in]handlerHandler delegate.
Returns
True if the request has been enqueued, error otherwise.

◆ Send() [2/2]

Equivalent to Send(AioStatusRef(), data, handler).

◆ GetIoService()

MAXON_METHOD AioServiceRef GetIoService ( ) const

Returns the I/O service that processes I/O operations of this instance.

◆ GetJobQueue()

MAXON_METHOD JobQueueRef GetJobQueue ( ) const

Returns the job queue that runs completion handlers of this instance.