ScummVM API documentation
Networking::ENet Class Reference

Public Member Functions

 ENet ()
 
bool initialize ()
 
HostcreateHost (const Common::String &address, int port, int numClients, int numChannels=1, int incBand=0, int outBand=0)
 
HostconnectToHost (const Common::String &hostAddress, int hostPort, const Common::String &address, int port, int timeout=5000, int numChannels=1, int incBand=0, int outBand=0)
 
HostconnectToHost (const Common::String &address, int port, int timeout=5000, int numChannels=1, int incBand=0, int outBand=0)
 
SocketcreateSocket (const Common::String &address, int port)
 

Constructor & Destructor Documentation

◆ ENet()

Networking::ENet::ENet ( )

The main object that allows for ENet host and socket creation.

Member Function Documentation

◆ initialize()

bool Networking::ENet::initialize ( )

Initializes the ENet library. Must be called first before any other functions.

Returns
true if successful, false on failure.

◆ createHost()

Host* Networking::ENet::createHost ( const Common::String address,
int  port,
int  numClients,
int  numChannels = 1,
int  incBand = 0,
int  outBand = 0 
)

Creates a new ENet Host instance for listening for/connecting to peers.

Parameters
addressthe address at which other peers may connect to this host. "0.0.0.0" may be to used to use the default host.
porta port number this host will use.
numClientsthe maximum number of peers that should be allocated for the host.
numChannelsthe maximum number of channels allowed; if 0, then this is equivalent to ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT
incBanddownstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth.
outBandupstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth.
Return values
Networking::Hostobject on success
nullptron failure
See also
Networking::Host

◆ connectToHost()

Host* Networking::ENet::connectToHost ( const Common::String hostAddress,
int  hostPort,
const Common::String address,
int  port,
int  timeout = 5000,
int  numChannels = 1,
int  incBand = 0,
int  outBand = 0 
)

Creates a new ENet Host instance, and attempts to connect to the assigned address and port.

Parameters
hostAddressthe address this host will use to connect to this peer. "0.0.0.0" may be to used to use the default host.
hostPorta port number this host will use. If not used, the host will use an allocated port given by the operating system.
addressthe address of the peer that will attempt to connect to.
portthe port number of the peer that will attempt to connect to.
timeoutspecifies the connection timeout in milliseconds, 5 full seconds by default. Will fail if the given time has passed.
numChannelsthe maximum number of channels allowed; if 0, then this is equivalent to ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT. This must match with the connecting peer.
incBanddownstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth. This must match with the connecting peer.
outBandupstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth. This must match with the connecting peer.
Return values
Networking::Hostobject on success
nullptron failure
See also
Networking::Host

◆ createSocket()

Socket* Networking::ENet::createSocket ( const Common::String address,
int  port 
)

Creates a Networking::Socket instance which is a representation of a raw UDP socket. Useful for and sending and receiving data that is outside the ENet library protocol.

Parameters
addressthe address this socket will send to and/or receive data from.
portthe port number this socket will send to and/or receive data from.
Return values
Networking::Socketobject on success
nullptron failure
See also
Networking::Socket

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