Distinct offers Network Monitor, the ONLY natural language Protocol Analyzer, ONC RPC for C++, .NET and Java, and IntelliTerm, the fastest Terminal Emulator for TN3270, TN5250 and VT420 on the market.

Distinct VIT: Ftp Client: OnSend

   Products   Downloads   Sales   Support   About us
  VIT
 



        
 
Summary

The OnSend event is fired during an event based put or append operation to get the next block of data.

Description

The OnSend event occurs during an event based transfer of data from the local machine to a remote file. An event driven put or append operation is started by calling the PutFile or AppendFile method (or by setting the FileAction property to FILE_ACTION_PUT or FILE_ACTION_APPEND) with the call to the EventMode method (or the TransferMode property set to TRANSFER_MODE_EVENT). The remote file must be specified with the RemoteFile parameter, but the LocalFile parameter is ignored and can be left blank.

With each event, the application is given a string buffer and an integer specifying the maximum number of bytes that can be copied into the string buffer. It is up to the application to obtain the data. The data copied into this buffer could, for example, be read from a disk file, received from another application using DDE or copied from the clipboard. Although less than the requested number of bytes can be assigned to the string buffer, it is generally preferable for performance reasons to copy the maximum number of bytes if they are available.

In some environments, such as Visual J++, the new value assigned to the Buffer parameter can not be successfully retrieved by the control. In these cases set UseProperty to True, and assign data to the SendData property instead of the Buffer parameter. The UseProperty property must be set to True before the FileAction property is set to FILE_ACTION_PUT or FILE_ACTION_APPEND (or before calling the PutFile or AppendFile method) In this case treat the SendData property exactly as you would the Buffer parameter. If UseProperty is True the Length parameter will be ignored.

To indicate that no more data is available to send, the application should clear the string buffer by assigning an empty string ("") to it. After returning an empty string buffer, no more OnSend events will be generated. The application can also terminate an event based transfer by setting the FileAction property to FILE_ACTION_ABORT (or by calling the AbortFile method can also be used) during the OnSend event. In this case, the returned string buffer is ignored by the control.

While handling the OnSend event, an application should not perform tasks, which have the potential of requiring a lot of time to complete, such as generating a message box.

Example

Sub FTPClient_OnSend (Buffer As String, Length As Integer)
Dim Message As String

If Len(Message) > 0 Then
Buffer = Message ' send message
Message = ""
Else
Buffer = Message ' indicate end of message
End If
End Sub

Sub FTPSend

FTPClient.Eventmode()

FTPClient.PutFile ("test.txt")

' OnSend event fired to get data

EndSub



Browse FAQ

Related Products
Mail Objects

Recommended Add-On
Network Monitor,
Protocol Analyzer


Raves
"The night before I went on summer holiday we had to make some 'last minute' configuration changes to approx. 300 routers, a tedious job to do manually with telnet. We went along with MS Excel containing a list of IP-adresses to the routers, and the VIT telnet-component. One hour later the VBA-application (small is beautiful) was working, and after another hour all of our routers were updated with the new configuration. I just say a big "Thanks" to you all for a good sleep that night."
Eirik Brendholen, Ergo Integration AS

"We conducted a test session to compare the performance of similar products, and Distinct's product was better!" [more]
Dr. Shyam Sunder, Carnegie Mellon University

"Together with Distinct, we were able to offer our users an ideal soution to enabling them to connect to Yahoo! Pager, and to do so both quickly and reliably." [more]
Brian Park,
Producer of Yahoo! Pager, Yahoo! Inc.


  10/11/2008   Legal notices | PRIVACY Policy | Networking News |