L_InetCreatePacketFromParams
#include "l_bitmap.h"
#include "ltnet.h"
L_INT EXT_FUNCTION L_InetCreatePacketFromParams(phPacket, uExtra, pExtra, uParams, pParams)
pHINETPACK phPacket; |
/* pointer to a packet */ |
L_UINT uExtra; |
/* size of the binary data*/ |
/* binary data to be sent */ | |
L_UINT uParams; |
/* number of parameters*/ |
pPARAMETER pParams; |
/* pointer to parameters */ |
Creates a packet using the specified parameters.
Parameter |
Description |
phPacket |
Pointer to variable to be update with the new packet. |
uExtra |
Size of the binary data. Used only if pExtra is not NULL. |
pExtra |
Binary (extra) data to be sent. Use NULL if there is no binary data to send. |
uParams |
The number of parameters for this packet. |
pParams |
Pointer to an array of parameters used to create the packet. This is valid only if uParams > 0). |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
This function allows the user to create a packet, containing the specified parameters, to send to a remote computer. Note that this packet can be used to send both commands and responses. The packet contains a binary chunk (described in uExtra and pExtra) and a fixed number of arguments (described in uParams and pParams).
This function is especially useful for sending an array of PARAMETER structures. This function is an alternative to using L_InetCreatePacket. It might be easier to use for people less familiar with C/C++.
Call L_InetFreePacket when you are done with the packet to free the memory allocated for the packet.
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
#define CMD_REVERSE CMD_USER_CUSTOM + 3
L_UINT guCommandID;
/* This example will create a command with only one parameter*/
L_INT ReverseRemoteBitmap(L_COMP hComputer, L_UINT uBitmapID)
{
PARAMETER Param;
HINETPACK hPacket;
L_INT nRet;
// initialize the parameter
Param.uType = PARAM_UINT32;
Param.uiValue = uBitmapID;
nRet = L_InetCreatePacketFromParams(&hPacket,
0, NULL, 1, &Param);
if(nRet != SUCCESS)
return nRet;
nRet = L_InetSendCmd(hComputer,
CMD_REVERSE, guCommandID++, hPacket);
L_InetFreePacket(hPacket);
return nRet;
}