websOpenServer GoAhead WebServer API GoAhead EMF

Synopsis

Open and initialize the GoAhead WebServer

Prototype

#include "wsIntrn.h"

int websOpenServer(int port, int retries);

Parameters

port The port on which to establish communications
retries The number of times to retry

Description

The websOpenServer procedure 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 websCloseServer when you wish to shutdown the GoAhead WebServer.

 

The port parameter specifies the TCP/IP port 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. .

Return Value

Returns the port number which was opened if the open succeeds, otherwise -1 is returned.

Example

if (websOpenServer(80, 5) < 0) {
    /* Can't initialize */
}

See Also

websCloseServer, websCloseListen, websOpenListen, websGetPort