Barracuda Application Server C/C++ Reference
NO
|
Create a server listen object.
The object binds itself to the SoDisp object and makes the web-server listen for new connections on the port specified. The default port is 80. You can create several of these objects and bind to the dispatcher if you want the web-server to listen to more than one port.
#include <HttpServCon.h>
Public Member Functions | |
HttpServCon (HttpServer *server, SoDisp *dispatcher, U16 port=80, BaBool setIP6=FALSE, const void *interfaceName=0, HttpServCon_AcceptNewCon userDefinedAccept=0) | |
Create a Server Connection. More... | |
BaBool | isValid () |
Returns true if the constructor successfully opened the listen socket; otherwise, false is returned. More... | |
int | setPort (U16 portNumber, bool setIp6=false, const void *interfaceName=0) |
Change the port number for the "listen" object. | |
HttpServCon::HttpServCon | ( | HttpServer * | server, |
SoDisp * | dispatcher, | ||
U16 | port = 80 , |
||
BaBool | setIP6 = FALSE , |
||
const void * | interfaceName = 0 , |
||
HttpServCon_AcceptNewCon | userDefinedAccept = 0 |
||
) |
Create a Server Connection.
server | is the web-server object. |
dispatcher | is SoDisp object. |
port | the server port, normally port 80. |
setIP6 | Set protcol version. This parameter is ignored unless the underlying TCP/IP stack is a dual IP V4 and IP V6 stack. |
interfaceName | the name of the interface used for binding the server socket. If this is zero, any available interface will be selected. |
userDefinedAccept | The default (argument is NULL) is to do "accept calls" for the web-server. |
A ServerConnection object is normally used for accepting new connections for the web-server. It is possible to redirect new connections to the "userDefinedAccept" callback function. This makes it possible to use the socket dispatcher logic in the web-server for implementing other services such as a telnet server.
The "user defined accept" callback function is called when a new connection is established. The HttpConnection object passed in as the argument to the callback function is a temporary object that will be destroyed as soon as the callback function returns. You must, therefore, copy the data in the connection object.
Example C code:
BaBool HttpServCon::isValid | ( | ) |
Returns true if the constructor successfully opened the listen socket; otherwise, false is returned.
Error messages are printed to HttpTrace.