4D Internet Commands v16

TCP_Receive

Home

 
4D Internet Commands v16
TCP_Receive

TCP_Receive 


 

TCP_Receive ( tcp_ID ; text ) -> Function result 
Parameter Type   Description
tcp_ID  Longint in Reference to an open TCP session
text  Text in Received Text
Function result  Integer in Error Code

Given a long integer reference to an established TCP Session, the TCP_Receive command receives packets of data into text.

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

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

Example  

 C_LONGINT($tcp_id)
 C_TEXT($webpage;$buffer)
 C_LONGINT(vState;$error)
 $webpage:=""
 vState:=0
 Repeat
    $error:=TCP_Receive($tcp_id;$buffer)
    $error:=TCP_State($tcp_id;vState)
    $webpage:=$webpage+$buffer
 Until((vState=0)|($error#0)) //until host closes connection or an error



See also 

TCP_Send
TCP_SendBLOB

 
PROPERTIES 

Product: 4D Internet Commands
Theme: IC TCP/IP
Number: 88930

 
HISTORY 

Created: 4D Internet Commands 6.5

 
ARTICLE USAGE

4D Internet Commands ( 4D Internet Commands v16)