ClassesClassesClassesClasses | | | | Operators

receive_datareceive_dataReceiveDatareceive_dataReceiveDataReceiveData (Operator)

Name

receive_datareceive_dataReceiveDatareceive_dataReceiveDataReceiveData — Receive arbitrary data from external devices or applications using a generic socket connection.

Signature

receive_data( : : Socket, Format : Data, From)

Herror receive_data(const Hlong Socket, const char* Format, char* Data, char* From)

Herror T_receive_data(const Htuple Socket, const Htuple Format, Htuple* Data, Htuple* From)

Herror receive_data(const HTuple& Socket, const HTuple& Format, char* Data, char* From)

HTuple HSocket::ReceiveData(const HTuple& Format, HTuple* From) const

void ReceiveData(const HTuple& Socket, const HTuple& Format, HTuple* Data, HTuple* From)

HTuple HSocket::ReceiveData(const HTuple& Format, HTuple* From) const

HTuple HSocket::ReceiveData(const HString& Format, HString* From) const

HTuple HSocket::ReceiveData(const char* Format, HString* From) const

void HOperatorSetX.ReceiveData(
[in] VARIANT Socket, [in] VARIANT Format, [out] VARIANT* Data, [out] VARIANT* From)

VARIANT HSocketX.ReceiveData(
[in] VARIANT Format, [out] VARIANT* From)

static void HOperatorSet.ReceiveData(HTuple socket, HTuple format, out HTuple data, out HTuple from)

HTuple HSocket.ReceiveData(HTuple format, out HTuple from)

HTuple HSocket.ReceiveData(string format, out string from)

Description

receive_datareceive_dataReceiveDatareceive_dataReceiveDataReceiveData receives arbitrary data over a generic socket connection. The received data is converted from a binary network packet to a value (or a tuple of values) using the parameter FormatFormatFormatFormatFormatformat as specification and is well-suited to communicate with external devices or applications. This operator does not support the standard 'HALCON'"HALCON""HALCON""HALCON""HALCON""HALCON" protocol, but is intended for arbitrary data transfer.

The received data is converted to a value or tuple of values using the parameter FormatFormatFormatFormatFormatformat. It is possible to specify multiple formats. In this case the FromFromFromFromFromfrom parameter will contain a 3rd value which tells you which format has been used to convert the data. To decide which format to use the size of the necessary data for each format is calculated initially. When data is received, the first format string with the matching size is used to convert the data to values.

The parameter FromFromFromFromFromfrom contains the IP address or hostname and port of the communication partner. For UDP connections it can be used in the send_datasend_dataSendDatasend_dataSendDataSendData operator to send a response.

Please see send_datasend_dataSendDatasend_dataSendDataSendData for a detailed description of the format.

Parallelization

Parameters

SocketSocketSocketSocketSocketsocket (input_control)  socket_id HSocket, HTupleHTupleHSocket, HTupleHSocketX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

Socket number.

FormatFormatFormatFormatFormatformat (input_control)  string(-array) HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Specification how to convert the data to tuples.

Default value: 'z' "z" "z" "z" "z" "z"

DataDataDataDataDatadata (output_control)  string HTupleHTupleHTupleVARIANTHtuple (string / real / integer) (string / double / int / long) (HString / double / Hlong) (char* / double / Hlong) (BSTR / double / Hlong) (char* / double / Hlong)

Value (or tuple of values) holding the received and converted data.

FromFromFromFromFromfrom (output_control)  string HTupleHTupleHTupleVARIANTHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong) (BSTR / Hlong) (char* / Hlong)

IP address or hostname and network port of the communication partner.

Possible Predecessors

open_socket_connectopen_socket_connectOpenSocketConnectopen_socket_connectOpenSocketConnectOpenSocketConnect, socket_accept_connectsocket_accept_connectSocketAcceptConnectsocket_accept_connectSocketAcceptConnectSocketAcceptConnect, get_socket_paramget_socket_paramGetSocketParamget_socket_paramGetSocketParamGetSocketParam, set_socket_paramset_socket_paramSetSocketParamset_socket_paramSetSocketParamSetSocketParam

Possible Successors

close_socketclose_socketCloseSocketclose_socketCloseSocketCloseSocket

See also

send_datasend_dataSendDatasend_dataSendDataSendData

Module

Foundation


ClassesClassesClassesClasses | | | | Operators