LInet::SendRawData

#include "ltwrappr.h"

L_INT LInet::SendRawData(plRemoteComp, pBuffer, pulBufferLength)

LInet L_FAR *plRemoteComp;

/* handle of remote computer */

L_CHAR L_FAR * pBuffer;

/* pointer to the data buffer to send */

L_INT32 L_FAR * pulBufferLength;

/* address of length of buffer */

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.

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: LEADTOOLS adds its own headers to the data being sent with LInet::SendData. LInet::SendRawData does not add any headers. The remote computer must disable auto process by calling LInet::EnableAutoProcess in order for the raw data to be received properly.

One possible use of this function, is to send raw data to a remote computer to detect if the remote is capable of handling LEADTOOLS’ headers. If the remote computer cannot handle LEADTOOLS' headers, then you can send all your data with LInet::SendRawData and keep auto process disabled on the remote computer for that connection.

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::SendData, 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

// a user defined class derived from LInet should be used to support the OnConnect callback function
// suppose it was named as LUserInet

LUserInet UserInet;
UserInet.StartUp();

// connect to LEAD.
UserInet.Connect("207.238.49.190", 1000);

// other operations
UserInet.ShutDown();

L_INT LUserInet::OnConnect(LInet L_FAR *plConnection, L_INT nError)
{
   L_CHAR L_FAR *pData;
   L_UINT32 ulDataSize;
   L_INT nRet = SUCCESS;

   if (nError != SUCCESS)
      return nError;

   pData = "Some Data";
   ulDataSize = strlen(pData);

   // now you can assume you are connected to remote computer
   nRet = SendRawData(plConnection, pData, &ulDataSize);

   // other operations

   // we can close the connection without data loss with a graceful connection. 
   //The closing occurs immediately 
   // and all the data will not be sent.
   Close(plConnection);

   return nRet;
}