RSP_newServer

Name

RSP_newServer -- Creates a data structure for an RSPD connection..

Synopsis

RSP_server* RSP_newServer(const char *szHost, int port, int timeout, int persistent);

Description

Creates a data structure which will be used to gather information from an RSPD server. This function must be called before any other server functions.

The parameters host and port specify the location of the server on the network. If host is not an IP address the function will attempt to do a DNS lookup. The persistent parameter should be 0 or 1 to specify if a persistent connection is desired. If turned off, a call to RSP_serverConnect will cause RSP Lib to connect to the RSPD, gather its data, then disconnect. Therefore each time that function is called a new connection will be established. If persistent connections are specified, the first call to RSP_serverConnect will initiate a connection but not close it. Each time the function is called after that the same connection will be used to gather data. The connection is finally ended when RSP_serverFree is called. If persistent connections are used, you may use RSP_serverSendKeepAlive to send a keep alive packet to the RSPD to make sure the connection is still active.

Returns

This function returns a pointer to an RSP_server structure, which contains information about this RSPD (including module data retrieved). This structure is passed to the rest of the RSPD functions. Be sure to free this data with RSP_serverFree after you are done with it.

Error Conditions

If an error occurs with this function, NULL is returned and rsp_error is set appropriately. Possible error values are: