websOpenListen GoAhead WebServer API GoAhead EMF

Synopsis

Open the TCP/IP port used by the web server to listen for browser requests

Prototype

#include "webs.h"

int websOpenListen(int port, int retries);

Parameters

port The port to open for GoAhead WebServer to listen on.
retries The number of times websOpenListen will try to open the next available port if port is not available

Description

The websOpenListen procedure opens the TCP/IP port on which the GoAhead WebServer listens for browser requests. You should call websCloseListen to close the existing listen port before calling websOpenListen. Normally websOpenListen is called automatically when you call websOpenServer .

The port parameter specifies the TCP/IP to open. If this cannot be opened and retries is greater than zero, the next port in sequence will be opened for up to retries times until a port is successfully opened. To determine the port number actually opened, call websGetPort.

Return Value

Returns 0 if the open succeeds, otherwise -1 is returned.

Example

websCloseListen();
websOpenListen(80, 5);

See Also

websCloseServer, websCloseListen, websOpenListen