LInetPacket::SetFormats
#include "ltwrappr.h"
L_INT LInetPacket::SetFormats(pszFormat)
/* format describing the parameters */ |
Sets or changes the parameter data associated with the LlnetPacket object.
Parameter |
Description | |
pszFormat |
Format of the command parameters. Possible values are: | |
|
Value |
Meaning |
|
%d |
decimal integer |
|
%l |
long signed integer |
|
%c |
character |
|
%s |
string |
|
%ud |
unsigned long integer |
|
%us |
unsigned short integer |
|
%ss |
signed short integer Variable list of parameters for this command. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An occurred. Refer to Return Codes. |
Comments
This function allows the user to set or change the parameter data associated with the LlnetPacket object. Note that this packet can be used to send both commands and responses. A packet can contain a binary chunk and a variable number of arguments.
To set or change the extra data, call LInetPacket::SetExtraData.
Required DLLs and Libraries
LTNET For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
Functions: |
|
Topics: |
Example
//This example sends a message to a remote connection to get a bitmap and send to the client
//This example also sets extra data to a sample string
//It is assumed that:
//1. m_Inet is an object of the class LInet.
//2. the network as been started (LInet::StartUp())
//3. a connection has been established with a remote server (LInet::m_Inet.Connect())
//4. GetNextCommandID() is a function that returns a unique command identifier
//5. UpdateStatusbar() is a function that displays a message in the status bar
//6. m_uWindowID is a window id that is received in the LInet::ResponseCallBack() as a result
// of a call to m_Inet.SendCreateWinCmd()
//7. m_uBitmapID is a bitmap id that is received in the LInet::ResponseCallBack() as a result
// of a call to m_Inet.SendLoadCmd()
void OnRemoteGetbitmap ()
{
L_INT nRet;
LInetPacket InetPacket;
InetPacket.SetFormats("%ud", m_uBitmapID);
L_CHAR *pszExtraData = "*** Sample Extra Data ***\n";
InetPacket.SetExtraData (strlen(pszExtraData) + 1, pszExtraData );
nRet = m_Inet.SendCmd (m_pInetRemoteServer, (CMDTYPE)CMD_GET, GetNextCommandID(), &InetPacket);
if(nRet != SUCCESS && nRet != ERROR_DATA_QUEUED)
UpdateStatusbar(TEXT("Error[%d]: OnRemoteGetbitmap"), nRet);
//LInetPacket destructor called here ...
}