LInet::SendData

#include "ltwrappr.h"

L_INT LInet::SendData(plRemoteComp, pBuffer, pulBufferLength, uDataType)

LInet plRemoteComp;

/* instance of a remote computer */

L_CHAR * pBuffer;

/* pointer to the data buffer to send */

L_SIZE_T *pulBufferLength;

/* address of a variable to be updated with the length of the buffer */

IDATATYPE uDataType;

/* data type */

Sends data to a remote computer.

Parameter

Description

plRemoteComp

Instance of remote computer to which data will be sent

pBuffer

Pointer to the buffer that contains the data to send

pulBufferLength

Address of a variable that contains the length of buffer, and which will be updated with the amount of data actually sent.

uDataType

Value indicating the type of data being sent. This value determines the type of headers added to the data. Possible values are:

 

Value

Meaning

 

IDATA_IMAGE

[0x0000] image data 

 

IDATA_MMEDIA

[0x0001] multimedia object 

 

IDATA_USER1

[0x0002] user data 

 

IDATA_USER2

[0x0003] user data 

 

IDATA_USER3

[0x0004] user data 

 

IDATA_USER4

[0x0005] user data 

 

The receiving computer will receive the appropriate Callback functions as follows:

 

On Send:

On Receive:

 

IDATA_IMAGE

LInet::OnImageReceived

 

IDATA_MMEDIA

LInet::OnMMediaReceived

 

IDATA_USER1

LInet::OnUser1Received

 

IDATA_USER2

LInet::OnUser2Received

 

IDATA_USER3

LInet::OnUser3Received

 

IDATA_USER4

LInet::OnUser4Received

 

Note: If an error occurs during sending or receiving and the headers become corrupted, then LInet::OnUser1Received will be called on the receiving computer. This means that to differentiate your own user-defined data from bad frames, you can use IDATA_USER2, IDATA_USER3 or IDATA_USER4.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

After this function returns, pulBufferLength will be updated with the amount of data that was actually sent. If pulBufferLength is less than the original value, then the rest of the data is queued, and will be sent at a later time. You do not need to re-send the data.

Note: With this function, LEADTOOLS adds its own headers to the data being sent. These headers need to be stripped by the remote computer, in order for the actual data to be processed. The remote computer can set auto process by calling LInet::EnableAutoProcess in order for the headers to be stripped.

You must initialize the LEADTOOLS Internet DLL using LInet::StartUp 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:

LInet::SendRawData, LInet::Connect, LInet::Close, LInet::ReadData, LInet::SendBitmap, LInet::SendSound, LInet::EnableAutoProcess, LInet::ServerInit, LInet::ClearQueue, LInet::GetQueueSize, LInet::StartUp, LInet::ShutDown, Class Members

Topics:

Sending and Receiving Data

Example

For an example, refer to LInet::GetQueueSize.