Cuberite
A lightweight, fast and extensible game server for Minecraft
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cUDPEndpoint Class Referenceabstract

Interface that provides methods available on UDP communication endpoints. More...

#include <Network.h>

Inheritance diagram for cUDPEndpoint:
Inheritance graph
[legend]
Collaboration diagram for cUDPEndpoint:
Collaboration graph
[legend]

Classes

class  cCallbacks
 Interface for the callbacks for events that can happen on the endpoint. More...
 

Public Member Functions

virtual void Close (void)=0
 Closes the underlying socket. More...
 
virtual void EnableBroadcasts (void)=0
 Marks the socket as capable of sending broadcast, using whatever OS API is needed. More...
 
virtual UInt16 GetPort (void) const =0
 Returns the local port to which the underlying socket is bound. More...
 
virtual bool IsOpen (void) const =0
 Returns true if the endpoint is open. More...
 
virtual bool Send (const AString &a_Payload, const AString &a_Host, UInt16 a_Port)=0
 Sends the specified payload in a single UDP datagram to the specified host + port combination. More...
 
virtual ~cUDPEndpoint ()
 

Protected Member Functions

 cUDPEndpoint (cCallbacks &a_Callbacks)
 Creates a new instance of an endpoint, with the specified callbacks. More...
 

Protected Attributes

cCallbacksm_Callbacks
 The callbacks used for various events on the endpoint. More...
 

Detailed Description

Interface that provides methods available on UDP communication endpoints.

Definition at line 175 of file Network.h.

Constructor & Destructor Documentation

◆ ~cUDPEndpoint()

virtual cUDPEndpoint::~cUDPEndpoint ( )
inlinevirtual

Definition at line 194 of file Network.h.

◆ cUDPEndpoint()

cUDPEndpoint::cUDPEndpoint ( cCallbacks a_Callbacks)
inlineprotected

Creates a new instance of an endpoint, with the specified callbacks.

Definition at line 220 of file Network.h.

Member Function Documentation

◆ Close()

virtual void cUDPEndpoint::Close ( void  )
pure virtual

Closes the underlying socket.

Note that there still might be callbacks in-flight after this method returns.

Implemented in cUDPEndpointImpl.

◆ EnableBroadcasts()

virtual void cUDPEndpoint::EnableBroadcasts ( void  )
pure virtual

Marks the socket as capable of sending broadcast, using whatever OS API is needed.

Without this call, sending to a broadcast address using Send() may fail.

Implemented in cUDPEndpointImpl.

◆ GetPort()

virtual UInt16 cUDPEndpoint::GetPort ( void  ) const
pure virtual

Returns the local port to which the underlying socket is bound.

Implemented in cUDPEndpointImpl.

◆ IsOpen()

virtual bool cUDPEndpoint::IsOpen ( void  ) const
pure virtual

Returns true if the endpoint is open.

Implemented in cUDPEndpointImpl.

◆ Send()

virtual bool cUDPEndpoint::Send ( const AString a_Payload,
const AString a_Host,
UInt16  a_Port 
)
pure virtual

Sends the specified payload in a single UDP datagram to the specified host + port combination.

Note that in order to send to a broadcast address, you need to call EnableBroadcasts() first.

Implemented in cUDPEndpointImpl.

Member Data Documentation

◆ m_Callbacks

cCallbacks& cUDPEndpoint::m_Callbacks
protected

The callbacks used for various events on the endpoint.

Definition at line 216 of file Network.h.


The documentation for this class was generated from the following file: