TcpConnection.Send (METH)
METHOD Send : ERROR_ID
Method to send data of an established TCP connection
VAR
fbTcpConnection : TcpConnection; (* Instance of function block - can be either TcpConnection or TcpClient. Anyhow a communication must be established before using the Receive method() *)
eErrorId : AC500_Tcp.ERROR_ID; (* Error Id of the Connect method *)
dwAddErrNo : AC500_Tcp.RTS_IEC_RESULT; (* Additional error number - list available in GVL of CmpErrors.Erros library *)
sDataSend : STRING(1000); (* Data buffer of the string that shall be send *)
END_VAR
------------
// Cyclic call of Send()
eErrorId := fbTcpConnection.Send( Data := ADR(sDataSend),
Size := TO_UDINT(StrLenA(ADR(sDataSend))),
AddErrNo => dwAddErrNo);
// As long as ERROR_ID = BUSY, the TcpConnection is waiting for incoming messages
IF eErrorId = AC500_Tcp.ERROR_ID.NO_ERROR OR eErrorId = AC500_Tcp.ERROR_ID.NO_ERROR_BUSY THEN
; // Telegram has been send successfully
ELSIF eErrorId <> AC500_Tcp.ERROR_ID.BUSY THEN
; // For ERR_INTERNAL, please check AddErrNo - AC500_Tcp.RTS_IEC_RESULT - the error codes are listed in the GVL of CmpErros.Errors
END_IF
- InOut:
Scope
Name
Type
Comment
Return
SendInput
DataPOINTER TO BYTE
Pointer to the data to be send
SizeUDINTSize or Length of the data
Output
AddErrNoRTS_IEC_RESULTAdditional error number gives information about error from SysSock2Close –> please see CmpErrors.Errors