# CreateUDPListener

## Description

Creates a UDP listener that will recieve UDP packets on the specified IP and port. The port value must be in the range 1 to 65535, although values below 1024 are likely to be protected by the operating system. If the port is already occupied then this command will fail and return 0. The IP address may be an IPv4 or IPv6 address, and can be used to bind to a single incomming network connection when a device has more than one IP. To bind to any IP address use the IP address "anyip4" or "anyip6". A single UDP listener can listen on either an IPv4 or an IPv6 address, but not both at the same time. To listen on both you should create two listeners, one for IPv4 and one for IPv6, in this case they may both use the same port. This command will return the ID of the listener that you can use to reference it in future commands.

## Definition

integer CreateUDPListener( listenerID, ip, port )

int agk::CreateUDPListener( UINT listenerID, const char* ip, int port )

integer CreateUDPListener( ip, port )

UINT agk::CreateUDPListener( const char* ip, int port )

## Parameters

- listenerID - The ID to use to reference this listener in future.
- ip - The local IP address to bind to.
- port - The local port to bind to.