CHttpServer::GetCommandResult Method  
 
INT GetCommandResult(
  UINT nClientId,  
  LPTSTR lpszResult,  
  INT nMaxLength  
);
INT GetCommandResult(
  UINT nClientId,  
  CString& strResult  
);

Return the result code and description for the last command issued by the client.

Parameters

nClientId
An unsigned integer which uniquely identifies the client session.
lpszResult
A pointer to a string buffer that will contain the description of the result code. The string buffer will be null terminated up to the maximum number of characters specified by the caller. This parameter can be NULL if this information is not required. An alternate version of this method accepts a CString object if it is available.
nMaxLength
An integer value that specifies the maximum number of characters that can be copied into the string buffer. If the lpszResult parameter is NULL, this value should be zero.

Return Value

An integer value which specifies the result code for the last command issued by the client. A return value of zero indicates that the command has not completed and there is no result code available.

Remarks

The GetCommandResult method is used to determine the result of the last command that was issued by the client and is typically called in the OnResult event handler. This method should only be called after a command has been processed or the SendResponse method has been called.

The result code is a three-digit integer value that indicates the success or failure of a command. Whenever a client sends a command to the server, the server must respond with this numeric code and a brief description of the the result. Result codes are generally broken down into the following categories:

Result Code Description
100-199 Result codes in this range are informational and only used with version 1.1 of the protocol. If the server returns a result code in this range, it means that it has received the request and that the client should proceed.
200-299 Result codes in this range indicate that the server has successfully completed the requested action. In most cases this means that the server has returned the requested data to the client, however if a 204 result code is sent, this indicates that the request has been processed but there is no data available.
300-399 Result codes in this range indicate that the requested resource has been moved to a new location. The most common result codes are 301 and 302. A value of 301 indicates that the location of the resource has changed permanently and all future requests should be sent to the new URL. A value of 302 indicates that the resource location has changed temporarily. The new location of the resource is sent to the client by setting the Location response header field.
400-499 Result codes in this range indicate an error with the request that was made by the client. These types of errors include invalid commands, requests that can only be issued by authenticated clients, or resources that cannot be accessed on the server. The most common result code in this range is the 404 code which indicates that the requested document could not be found.
500-599 Result codes in this range indicate a server error has occurred while processing a valid request. These types of errors are returned when a command has not been implemented, the execution of a CGI program or script has failed unexpectedly, or an internal server error has occurred.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: cshtsv11.lib
Unicode: Implemented as Unicode and ANSI versions

See Also

ReceiveRequest, SendResponse, OnResult