MsgCommunicator: Delphi Instant Messaging (IM) SDK
for easy creation of custom messenger system
Sends a stream with progress indicator support.
function SendStream(ToUserID: Cardinal;
Blocks: Integer = 0;
BlockSize: Integer = 0;
Directly: Boolean = True): Integer;
Call SendStream to send a stream. SendStream sends request to the recepient. If receiving side has AllowFiles property set to True, recepient enable sender to send, in other case one of the error codes (starting with MSG_Error_InitProgressSend) occurs. After this initial procedure, client sends file splitted by blocks as usual messages. Client can send/receive any number of streams at the same time.
ToUserID is an unique idetifier of a recepient, client or server.
Stream - a stream to send.
Blocks - number of blocks the stream will be split in transmission.
BlockSize - maximum size (in bytes) of one block (latest block can be less).
Directly - set to False to send thru server. If a client cannot send Stream directly, it will try to send it thru server automatically.
Set BlockSize to specify the size of portions the stream will be sent by. BlockSize is the size of stream data which will be transmetted for a single portion. The size of network packet can be greater due packet header will be added. If you specify too small size, it will be set to default value MsgDefaultPacketSize (including packet header) for maximal compliance with network MTU. If BlockSize you specified is greater then the PacketSize property, each data portion will be sent as a number of network packets.
Set Blocks to specify the number of portion the stream will be split into. In this case BlockSize will be defined based on stream size and specified Blocks parameter.
To learn the progress state, set event handler TMsgClient.OnSendStream.
To receive streams on the other side, set event handler OnReceiveStream.
If SendStream is finished successfully, it returns MSG_COMMAND_OK.
SendStream can return one of the following error codes:
Note: You must not change stream data, Size and Position while it is transmitting.