L_InetAcceptConnect

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

L_INT EXT_FUNCTION L_InetAcceptConnect(hHost, phRemote, pfnCallback, pUserData)

L_COMP hHost;

/* handle of host computer */

L_COMP L_FAR * phRemote;

/* address of variable to update */

INETCALLBACK pfnCallback;

/* pointer to a callback function */

L_VOID L_FAR *pUserData;

/* user defined callback data */

Accepts an incoming connection from a remote computer.

Parameter

Description

hHost

Handle of the host computer which is to accept the connection

phRemote

Address of the variable to be updated with the handle of the remote computer to which hHost is being connected.

pfnCallback

Pointer to a callback function of type INETCALLBACK, for receiving messages for phRemote. 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

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

You must call L_InetServerInit to get a valid handle for hHost before any connections can be accepted using this function.

After this function returns, phRemote will be updated with the handle of the computer that was requesting the connection.

You can use L_InetGetHostName to see who is trying to connect to hHost, after you accept the connection, using this function. If you then wish to restrict access, you can disconnect phRemote after examining the hostname.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

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_InetConnect, L_InetClose, L_InetGetHostName, L_InetStartUp, L_InetShutDown

Topics:

Internet Functions

Example

For an example, refer to L_InetServerInit.