Aw create resolved

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 2.1
SDKbuild 13


int aw_create_resolved (unsigned long address, int port, void **instance)

Description

Same as aw_create, except it takes an already resolved address for the universe server.

Callback

AW_CALLBACK_CREATE

Notes

This method presents a fully asynchronous way of creating instances (apart from when aw_create connects to an address in dotted quad form). It is up to the application to do hostname-to-address resolution. Which means it can employ an asynchronous method for doing so (e.g. WSAAsyncGetHostByName).

The universe server must be running version 2.1 or later to accept connections from SDK applications.

See aw_create for more information.

Argument

address
IP address, must be in network byte order (i.e. most significant byte is stored first in memory).
port
May be specified as 0 to take the default port. The default is port 6670 for v4.1 or newer, and port 5670 for v3.6 or older.
instance
Pointer to where an instance pointer is returned. May be specified as NULL if it is not desired.

Argument attributes

None

Return values

RC_SUCCESS (1)
RC_NOT_INITIALIZED (1)
WSAECONNRESET (1) (2)
Connection was reset by universe.
RC_TIMEOUT (2)
Connection attempt timed out, connection was reset by universe, or handshake timed out.
RC_NO_CONNECTION (2)
Connection was reset by universe while waiting for handshake to succeed.

(1) Possible return values when a callback is installed.

(2) Automatic reconnection attempt in 20 seconds. Provided that aw_wait is called.

Returned attributes

None

Usage

unsigned long my_resolve (char *hostname);

int rc;

rc = aw_create_resolved (my_resolve ("auth.activeworlds.com"), 0, NULL);
if (rc != RC_SUCCESS)
  printf ("Unable to create a bot (reason %d)\n", rc);

See also