Aw init bind

From ActiveWiki
Jump to: navigation, search

Minimum requirements
Added in version 4.1
SDKbuild 61

int aw_init_bind (int build, unsigned long addr)


Initializes the SDK and specifies the source IP address for outbound connections.


None (returns immediately)


Specifying the source IP address is useful when you have multiple network interface cards (NIC) or a single NIC with multiple IP addresses. The source IP address must either match or be within range of the IP address(es) used by a network interface on the system.

This method or aw_init must be called once before any other methods in the API. It will do an implicit aw_term if the SDK has already been successfully initialized. Thus, there is no need to call aw_term for each additional call to this method, as there is no reference count.

If successful then the tick count returned by aw_tick is reset to 0 and the pseudo-random number generator used by aw_random is seeded.


AW_BUILD in Aw.h defines the build of Aw.dll (or for Linux) it was distributed with and should be passed as the value of this argument.
Source IP address for outbound connections (in network byte order.) If set to 0 ( then it will be the same as calling aw_wait.

Argument attributes


Return values

Aw.h and Aw.dll (or for Linux) are from different builds of the SDK.

Returned attributes



#include "Aw.h"
#include "Reason.h"

int main (int argc, char *argv[])
  /* use as the source for outbound connections */
  if (aw_init_bind (AW_BUILD, inet_addr ("")) != RC_SUCCESS)
    printf ("Build #%d of Aw.dll is required to run this bot.\n", AW_BUILD);
    return 1;
  /* ... */
  aw_term ();
  return 0;

See also