# CreateSocketListener

## Description

Creates a socket listener that listens on a specified port for incoming socket connections. When a connection occurs it will be held in a queue until you retrieve it with GetSocketListnerConnection. If you want to reject a connection you must retrieve it and then delete it. The listener will continue accepting connections until it is deleted. If your device has multiple network interfaces then you can specify which one to listen on by using the IP address parameter. To listen on all interfaces use an empty string as the IP address. You can have multiple listeners active at the same time, but they must all use different ports. When choosing a port number you should avoid low values as these will frequently be used by other apps and services. If something is alerady listening on a port then your attempt to listen on it will fail. Returns 0 if it failed to start listening.

## Definition

integer CreateSocketListener( listenerID, szIP, port )

int agk::CreateSocketListener( UINT listenerID, const char *szIP, int port )

integer CreateSocketListener( szIP, port )

UINT agk::CreateSocketListener( const char *szIP, int port )

## Parameters

- listenerID - An ID to use to reference this listener in the future
- szIP - The IP address of the interface to listen on
- port - The TCP port to listen on, in the range 1025 to 65535