websOpenGoAhead WebServer APIGoAhead EMF

Synopsis

Open and initialize the GoAhead WebServer.

Prototype

 #include "webs.h" 

 int websOpen(int port, int retries); 

Parameters

portThe port to open for GoAhead WebServer to listen on.
retriesThe number of times websOpen will try to open the next available port if port is not available.

Description

websOpen is the main initialization procedure for the GoAhead WebServer. It creates all the URL handlers, initializes the mime type table and finally calls websOpenListen to open the primary TCP/IP port on which the GoAhead WebServer will listen. You should call websClose when you wish to shutdown the GoAhead WebServer.

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

 websOpen(80, 5); 

Stability Classification

Stable.

See Also

websClose, websCloseListen, websOpenListen