LInet::OnUser2Received

#include "ltwrappr.h"

virtual L_INT LInet::OnUser2Received(plConnection, nError, pBuffer, ulSize)

LInet * plConnection;

/* instance of a remote computer */

L_INT nError;

/* error code */

L_CHAR * pBuffer;

/* buffer containing data */

L_SIZE_T ulSize;

/* size of the buffer */

Overridable function that notifies a computer that user defined data has been received.

Parameter

Description

plConnection

Pointer to the instance of the remote computer that sent the user-defined data.

nError

If no error has occurred, nError will be SUCCESS. If nError is < SUCCESS, an error has occurred.

pBuffer

Pointer to the buffer that contains the data of a user-defined format.

ulSize

Size of pBuffer.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

If nError is < SUCCESS, pBuffer should be ignored.

The buffer pointed to by pBuffer will be freed upon returning from this function.

Do not delete plConnection.

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:

Class Members

Topics:

Sending and Receiving Data

Example

// a user defined class derived from LInet should be used to support the 
// OnUser2Received, OnUser3Received and OnUser4Received callback functions
// suppose it was named as LUserInetOU2R
class LUserInetOU2R : public LInet
{
protected:
   virtual  L_INT OnUser2Received(LInet plConnection, L_INT nError, L_CHAR *pBuffer, L_UINT32 ulSize);
   virtual  L_INT OnUser3Received(LInet plConnection, L_INT nError, L_CHAR pBuffer, L_UINT32 ulSize);
   virtual  L_INT OnUser4Received(LInet plConnection, L_INT nError, L_CHAR *pBuffer, L_UINT32 ulSize);
};
L_INT LInet__OnUser2ReceivedExample()
{
   L_INT          nRet;
   LUserInetOU2R  UserInet;
   LInet*         plRemote = NULL;
   L_CHAR*        pBuffer = NULL;
   L_SIZE_T*      pulBufferLength = NULL;
   // connect to LEAD
   nRet = UserInet.Connect("207.238.49.190", 1000);
   if(nRet != SUCCESS)
      return nRet;
   nRet = UserInet.SendData(plRemote, pBuffer, pulBufferLength, IDATA_USER2);
   if(nRet != SUCCESS)
      return nRet;
   nRet = UserInet.SendData(plRemote, pBuffer, pulBufferLength, IDATA_USER3);
   if(nRet != SUCCESS)
      return nRet;
   nRet = UserInet.SendData(plRemote, pBuffer, pulBufferLength, IDATA_USER4);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}
L_INT LUserInetOU2R::OnUser2Received(LInet plConnection, L_INT nError, L_CHAR *pBuffer, L_UINT32 ulSize)
{
   UNREFERENCED_PARAMETER(nError);
   UNREFERENCED_PARAMETER(pBuffer);
   UNREFERENCED_PARAMETER(ulSize);
   // other operations
   return SUCCESS;
}
L_INT LUserInetOU2R::OnUser3Received(LInet plConnection, L_INT nError, L_CHAR pBuffer, L_UINT32 ulSize)
{
   UNREFERENCED_PARAMETER(nError);
   UNREFERENCED_PARAMETER(pBuffer);
   UNREFERENCED_PARAMETER(ulSize);
   // other operations
   return SUCCESS;
}
L_INT LUserInetOU2R::OnUser4Received(LInet plConnection, L_INT nError, L_CHAR *pBuffer, L_UINT32 ulSize)
{
   UNREFERENCED_PARAMETER(nError);
   UNREFERENCED_PARAMETER(pBuffer);
   UNREFERENCED_PARAMETER(ulSize);
   // other operations
   return SUCCESS;
}