L_InetSetCallback

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSetCallback(hComputer, pfnCallback, pUserData)

L_COMP hComputer;

/* computer to associate the callback data with */

INETCALLBACK pfnCallback;

/* callback to associate */

L_VOID L_FAR * pUserData;

/* user data to associate */

Sets the function that will receive notifications for the specified computer handle.

Parameter

Description

hComputer

Handle to the computer that will be associated with the callback function and the user data.

pfnCallback

Pointer to a callback function of type INETCALLBACK, for receiving messages for hComputer. Use the function pointer to your callback function as the value of this parameter.

pUserData

Void pointer that you can use to pass one or more additional parameters that the callback function needs.

 

To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID L_FAR  *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.

 

If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS

This function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function can be used to change the function that will receive notifications for a computer handle. It can also be used to change the user data associated with it

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:

L_InetServerInit, L_InetAcceptConnect, L_InetConnect, L_InetGetCallback

Topics:

Sending Commands and Responses

 

A Client-Server Diagram: Sending Commands and Responses

Example

L_VOID SetNewCallbackData(L_COMP hComputer, L_VOID L_FAR*pData)

{

   INETCALLBACK pfnCallback; 

   L_VOID L_FAR* pUserData; 

 

   L_InetGetCallback(hComputer, &pfnCallback, &pUserData);

   if(pData != pUserData) 

      L_InetSetCallback(hComputer, pfnCallback, pData);

}