Skip to content

enet

initialize() function

Initialize the ENet library. Must be called before using any ENet functionality. Throws an error if initialization fails.

Returns: None

deinitialize() function

Deinitialize the ENet library, cleaning up all resources. Call this when you no longer need any ENet functionality.

Returns: None

create_host(address) function

Create an ENet host for either a client-like unbound host or a server bound to a specific address and port:

  • If no argument is provided, creates an unbound "client-like" host with default settings (maximum 32 peers, 2 channels, unlimited bandwidth).
  • If you pass an "ip:port" string (e.g. "127.0.0.1:7777"), it creates a server bound to that address. The server supports up to 32 peers, 2 channels, and unlimited bandwidth.

Throws an error if host creation fails for any reason.

omit to create an unbound client-like host.

address: (optional) A string in 'ip:port' format to bind the host (server), or

Returns: An ENetHost object.