ClassesClassesClassesClasses | | | | Operators

open_socket_connectopen_socket_connectOpenSocketConnectopen_socket_connectOpenSocketConnectOpenSocketConnect (Operator)

Name

open_socket_connectopen_socket_connectOpenSocketConnectopen_socket_connectOpenSocketConnectOpenSocketConnect — Open a socket and connect it to an accepting socket.

Signature

open_socket_connect( : : HostName, Port, GenParamName, GenParamValue : Socket)

Herror open_socket_connect(const char* HostName, const Hlong Port, const char* GenParamName, const char* GenParamValue, Hlong* Socket)

Herror T_open_socket_connect(const Htuple HostName, const Htuple Port, const Htuple GenParamName, const Htuple GenParamValue, Htuple* Socket)

Herror open_socket_connect(const HTuple& HostName, const HTuple& Port, const HTuple& GenParamName, const HTuple& GenParamValue, Hlong* Socket)

void HSocket::OpenSocketConnect(const HTuple& HostName, const HTuple& Port, const HTuple& GenParamName, const HTuple& GenParamValue)

void OpenSocketConnect(const HTuple& HostName, const HTuple& Port, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Socket)

void HSocket::HSocket(const HString& HostName, Hlong Port, const HTuple& GenParamName, const HTuple& GenParamValue)

void HSocket::HSocket(const HString& HostName, Hlong Port, const HString& GenParamName, const HString& GenParamValue)

void HSocket::HSocket(const char* HostName, Hlong Port, const char* GenParamName, const char* GenParamValue)

void HSocket::OpenSocketConnect(const HString& HostName, Hlong Port, const HTuple& GenParamName, const HTuple& GenParamValue)

void HSocket::OpenSocketConnect(const HString& HostName, Hlong Port, const HString& GenParamName, const HString& GenParamValue)

void HSocket::OpenSocketConnect(const char* HostName, Hlong Port, const char* GenParamName, const char* GenParamValue)

void HOperatorSetX.OpenSocketConnect(
[in] VARIANT HostName, [in] VARIANT Port, [in] VARIANT GenParamName, [in] VARIANT GenParamValue, [out] VARIANT* Socket)

void HSocketX.OpenSocketConnect(
[in] BSTR HostName, [in] Hlong Port, [in] VARIANT GenParamName, [in] VARIANT GenParamValue)

static void HOperatorSet.OpenSocketConnect(HTuple hostName, HTuple port, HTuple genParamName, HTuple genParamValue, out HTuple socket)

public HSocket(string hostName, int port, HTuple genParamName, HTuple genParamValue)

public HSocket(string hostName, int port, string genParamName, string genParamValue)

void HSocket.OpenSocketConnect(string hostName, int port, HTuple genParamName, HTuple genParamValue)

void HSocket.OpenSocketConnect(string hostName, int port, string genParamName, string genParamValue)

Description

open_socket_connectopen_socket_connectOpenSocketConnectopen_socket_connectOpenSocketConnectOpenSocketConnect opens a connecting socket to an accepting socket on the computer HostNameHostNameHostNameHostNameHostNamehostName, which listens on port PortPortPortPortPortport.

The parameter 'protocol'"protocol""protocol""protocol""protocol""protocol" may be used to specify the protocol to be used. The default is the 'HALCON'"HALCON""HALCON""HALCON""HALCON""HALCON" protocol without specific address family. Therefore, IPv4 or IPv6 will be used automatically depending on the network configuration of the computer. To use a specific address family a '4' or '6' (for IPv4 or IPv6, respectively) must be appended to the name of the protocol. For example, 'HALCON4'"HALCON4""HALCON4""HALCON4""HALCON4""HALCON4" designates a HALCON connection over IPv4. Possible values for a generic socket communication are 'UDP'"UDP""UDP""UDP""UDP""UDP" and 'TCP'"TCP""TCP""TCP""TCP""TCP" which also support appended '4' and '6'. Alternatively, the usage of addresses for IPv4 (e.g. '127.0.0.1'"127.0.0.1""127.0.0.1""127.0.0.1""127.0.0.1""127.0.0.1") or IPv6 (e.g. '::1'"::1""::1""::1""::1""::1") for HostNameHostNameHostNameHostNameHostNamehostName determines the address family to be used.

Both communication partners must use the same protocol. To exchange data using generic sockets use send_datasend_dataSendDatasend_dataSendDataSendData and receive_datareceive_dataReceiveDatareceive_dataReceiveDataReceiveData only.

The generic parameter 'timeout'"timeout""timeout""timeout""timeout""timeout" can be used to set a timeout for this operation. The timeout is given in seconds or as the string 'infinite'"infinite""infinite""infinite""infinite""infinite".

For the 'HALCON'"HALCON""HALCON""HALCON""HALCON""HALCON" protocol the listening socket must have been created earlier with the operator open_socket_acceptopen_socket_acceptOpenSocketAcceptopen_socket_acceptOpenSocketAcceptOpenSocketAccept in another HALCON process. To establish the connection, the HALCON process, in which the accepting socket resides, must call socket_accept_connectsocket_accept_connectSocketAcceptConnectsocket_accept_connectSocketAcceptConnectSocketAcceptConnect. For a detailed example, see open_socket_acceptopen_socket_acceptOpenSocketAcceptopen_socket_acceptOpenSocketAcceptOpenSocketAccept.

For generic sockets the socket to connect to can be any socket from the same protocol type.

Parallelization

Parameters

HostNameHostNameHostNameHostNameHostNamehostName (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Hostname of the computer to connect to.

Default value: 'localhost' "localhost" "localhost" "localhost" "localhost" "localhost"

PortPortPortPortPortport (input_control)  number HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Port number.

Suggested values: 3000, 4570

Typical range of values: 1024 ≤ Port Port Port Port Port port ≤ 65535

Minimum increment: 1

Recommended increment: 1

GenParamNameGenParamNameGenParamNameGenParamNameGenParamNamegenParamName (input_control)  attribute.name(-array) HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Names of the generic parameters that can be adjusted for the socket.

Default value: []

List of values: 'protocol'"protocol""protocol""protocol""protocol""protocol", 'timeout'"timeout""timeout""timeout""timeout""timeout"

GenParamValueGenParamValueGenParamValueGenParamValueGenParamValuegenParamValue (input_control)  attribute.name(-array) HTupleHTupleHTupleVARIANTHtuple (string / real / integer) (string / double / int / long) (HString / double / Hlong) (char* / double / Hlong) (BSTR / double / Hlong) (char* / double / Hlong)

Values of the generic parameters that can be adjusted for the socket.

Default value: []

Suggested values: 0, 3.0, 'infinite'"infinite""infinite""infinite""infinite""infinite", 'HALCON'"HALCON""HALCON""HALCON""HALCON""HALCON", 'UDP'"UDP""UDP""UDP""UDP""UDP", 'TCP'"TCP""TCP""TCP""TCP""TCP", 'HALCON4'"HALCON4""HALCON4""HALCON4""HALCON4""HALCON4", 'UDP4'"UDP4""UDP4""UDP4""UDP4""UDP4", 'TCP4'"TCP4""TCP4""TCP4""TCP4""TCP4", 'HALCON6'"HALCON6""HALCON6""HALCON6""HALCON6""HALCON6", 'UDP6'"UDP6""UDP6""UDP6""UDP6""UDP6", 'TCP6'"TCP6""TCP6""TCP6""TCP6""TCP6"

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

Socket number.

Possible Successors

send_imagesend_imageSendImagesend_imageSendImageSendImage, receive_imagereceive_imageReceiveImagereceive_imageReceiveImageReceiveImage, send_regionsend_regionSendRegionsend_regionSendRegionSendRegion, receive_regionreceive_regionReceiveRegionreceive_regionReceiveRegionReceiveRegion, send_tuplesend_tupleSendTuplesend_tupleSendTupleSendTuple, receive_tuplereceive_tupleReceiveTuplereceive_tupleReceiveTupleReceiveTuple, send_datasend_dataSendDatasend_dataSendDataSendData, receive_datareceive_dataReceiveDatareceive_dataReceiveDataReceiveData

See also

open_socket_acceptopen_socket_acceptOpenSocketAcceptopen_socket_acceptOpenSocketAcceptOpenSocketAccept, socket_accept_connectsocket_accept_connectSocketAcceptConnectsocket_accept_connectSocketAcceptConnectSocketAcceptConnect, get_socket_paramget_socket_paramGetSocketParamget_socket_paramGetSocketParamGetSocketParam, set_socket_paramset_socket_paramSetSocketParamset_socket_paramSetSocketParamSetSocketParam, close_socketclose_socketCloseSocketclose_socketCloseSocketCloseSocket

Module

Foundation


ClassesClassesClassesClasses | | | | Operators