TCP_ReceiveBLOB

4D - Documentation   Français   English   German   Japanese   4D Internet Commands, Theme List   4D Internet Commands, Alphabetical List   Back   Previous   Next

version 6.7


TCP_ReceiveBLOB (tcp_ID; blobToReceive) Integer

ParameterTypeDescription
tcp_IDLongintReference to an open TCP session
blobToReceiveBLOBBLOB to receive data
Function resultIntegerError Code

Description

Given a long integer reference to an established TCP session, the TCP_ReceiveBLOB command receives packets of data into blobToReceive.

This command performs the same action as TCP_Receive, except that it will receive data in a BLOB instead of a text, which allows bypassing the 32K text limitation. You can then receive binary objects.

tcp_ID is a long integer reference to an open TCP session as established with either the TCP_Open or TCP_Listen command.

blobToReceive is the BLOB which receives data. When receiving data via TCP packets, you cannot count on all of your data being received by a single TCP_ReceiveBLOB call. The TCP_ReceiveBLOB command is usually called within a Repeat...Until loop which continually checks on the status of the connection or is scanning for a known value.

Example

This example shows the typical structure of a method using TCP_ReceiveBLOB:

   C_BLOB($Blob_Received;$Blob_All)
   C_LONGINT($srcpos;$dstpos)
   Repeat 
      $Err:=TCP_ReceiveBLOB ($TCP_ID;$Blob_Received )
      $Err:=TCP_State ($TCP_ID;$State)
      $srcpos:=0
      $dstpos:= BLOB size($Blob_All)
         `Concatenating received Blobs
      COPY BLOB($Blob_Received;$Blob_All;$srcpos;$dstpos;BLOB size($Blob_Received)) 
   Until(($State=0) | ($Err#0))

See Also

TCP_Listen, TCP_Open, TCP_Receive, TCP_SendBLOB.


4D - Documentation   Français   English   German   Japanese   4D Internet Commands, Theme List   4D Internet Commands, Alphabetical List   Back   Previous   Next