AspenBuildServerAddress()

 

Related Items

 

 

Purpose

Formats an Aspen Server address for use with the Aspen API.

 

 

Syntax

#include <aspen.h>

...

int AspenBuildServerAddress(

    int           family,

    char          *server_name,

    ASPEN_ADDRESS *address );

 

 

Parameters

family

family indicates the network transport protocol to be used for communication with the Aspen Server. Currently only ASPEN_INET is supported. ASPEN_IPX is not currently supported.

 

Currently, ASPEN_INET is the only valid value for this parameter.

 

*server_name

*server_name specifies an Aspen Server. For ASPEN_INET addresses, the *server_name can be either the Internet address (255.0.0.0) or the DNS-host name (machine.domain.com).

 

*address

*address is a pointer to an ASPEN_ADDRESS structure that receives the Server address if the function is successful.

 

 

Remarks

The API must be initialized using AspenInit() before the first call to AspenBuildServerAddress().

 

 

Return Value

ASPEN_OK

if successful.

ASPEN_RC_TRANSPORT_ERROR

if a network transport provider could not be accessed.

 

 

See Also

ASPEN_ADDRESS

ASPEN_OpenSession

AspenInit()

ASPEN_VALIDATE_INPUT

ASPEN_VALIDATE_OUTPUT

 

 

Example

int CAspenRequestDlg::DoASPEN_ValidateSession()

{

   ASPEN_ADDRESS serverAddress;

   ASPEN_VALIDATE_INPUT validateRequest;

   ASPEN_VALIDATE_OUTPUT validateReply;

   char IPaddress[20];

   server_list *slp = list;

   int retval;

   /* Connect to Server */

   strcpy(IPaddress, svServerAddr);

   /* Build Server Address */

   retval = AspenBuildServerAddress(ASPEN_INET,

                                    IPaddress,

                                    &serverAddress);

   if (retval != ASPEN_OK)

   {

   return retval;

   }

   /* Open Session */

   retval = AspenRequest(0,

                         ASPEN_OpenSession,

                         (void *)&serverAddress,

                         &slp->server_session);

   if (retval == ASPEN_OK)

   {

   /* Validate request */

   strcpy(validateRequest.username, svUserName);

   strcpy(validateRequest.password, svPassword);

   strcpy(validateRequest.newpassword, "");

 

   retval = AspenRequest(slp->server_session,

                         ASPEN_ValidateSession,

                         &validateRequest,

                         &validateReply);

   }

   return retval;

}

 

©2006 Aspen Research Group, Ltd. All rights reserved. Terms of Use.