Name
open_socket_acceptopen_socket_acceptOpenSocketAcceptopen_socket_acceptOpenSocketAcceptOpenSocketAccept — Open a socket that accepts connection requests.
void OpenSocketAccept(const HTuple& Port, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* AcceptingSocket)
void HSocket::HSocket(Hlong Port, const HTuple& GenParamName, const HTuple& GenParamValue)
void HSocket::HSocket(Hlong Port, const HString& GenParamName, const HString& GenParamValue)
void HSocket::HSocket(Hlong Port, const char* GenParamName, const char* GenParamValue)
void HSocket::OpenSocketAccept(Hlong Port, const HTuple& GenParamName, const HTuple& GenParamValue)
void HSocket::OpenSocketAccept(Hlong Port, const HString& GenParamName, const HString& GenParamValue)
void HSocket::OpenSocketAccept(Hlong Port, const char* GenParamName, const char* GenParamValue)
static void HOperatorSet.OpenSocketAccept(HTuple port, HTuple genParamName, HTuple genParamValue, out HTuple acceptingSocket)
public HSocket(int port, HTuple genParamName, HTuple genParamValue)
public HSocket(int port, string genParamName, string genParamValue)
void HSocket.OpenSocketAccept(int port, HTuple genParamName, HTuple genParamValue)
void HSocket.OpenSocketAccept(int port, string genParamName, string genParamValue)
open_socket_acceptopen_socket_acceptOpenSocketAcceptopen_socket_acceptOpenSocketAcceptOpenSocketAccept opens a socket that will accept incoming
connection requests. This operator is the
necessary first step in the establishment of a communication channel
between two HALCON processes. The socket listens for incoming
connection requests on the port number given by PortPortPortPortPortport.
The generic 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'.
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 socket. The timeout is given in seconds or as the string
'infinite'"infinite""infinite""infinite""infinite""infinite". It is used especially as timeout and waiting mode
in a following socket_accept_connectsocket_accept_connectSocketAcceptConnectsocket_accept_connectSocketAcceptConnectSocketAcceptConnect call with the parameter
Wait set to 'auto'"auto""auto""auto""auto""auto".
The accepting socket is returned in AcceptingSocketAcceptingSocketAcceptingSocketAcceptingSocketAcceptingSocketacceptingSocket.
open_socket_acceptopen_socket_acceptOpenSocketAcceptopen_socket_acceptOpenSocketAcceptOpenSocketAccept returns immediately without waiting for a request
from another process, which must be initiated by calling
open_socket_connectopen_socket_connectOpenSocketConnectopen_socket_connectOpenSocketConnectOpenSocketConnect. This allows multiple other processes to connect
to the particular HALCON process that calls open_socket_acceptopen_socket_acceptOpenSocketAcceptopen_socket_acceptOpenSocketAcceptOpenSocketAccept. To
accept an incoming 'HALCON'"HALCON""HALCON""HALCON""HALCON""HALCON" or 'TCP'"TCP""TCP""TCP""TCP""TCP" connection request,
socket_accept_connectsocket_accept_connectSocketAcceptConnectsocket_accept_connectSocketAcceptConnectSocketAcceptConnect must be called to obtain a socket for the final
communication.
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Port number.
Default value: 3000
Suggested values: 3000, 4570
Typical range of values: 1024
≤
Port
Port
Port
Port
Port
port
≤
65535
Minimum increment: 1
Recommended increment: 1
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"
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"
* Process 1
dev_set_colored (12)
open_socket_accept (3000, [], [], AcceptingSocket)
* Busy wait for an incoming connection
dev_error_var (Error, 1)
dev_set_check ('~give_error')
OpenStatus := 5
while (OpenStatus != 2)
socket_accept_connect (AcceptingSocket, 'false', Socket)
OpenStatus := Error
wait_seconds (0.2)
endwhile
dev_set_check ('give_error')
* Connection established
receive_image (Image, Socket)
threshold (Image, Region, 0, 63)
send_region (Region, Socket)
receive_region (ConnectedRegions, Socket)
area_center (ConnectedRegions, Area, Row, Column)
send_tuple (Socket, Area)
send_tuple (Socket, Row)
send_tuple (Socket, Column)
close_socket (Socket)
close_socket (AcceptingSocket)
* Process 2
dev_set_colored (12)
open_socket_connect ('localhost', 3000, [], [], Socket)
read_image (Image, 'fabrik')
send_image (Image, Socket)
receive_region (Region, Socket)
connection (Region, ConnectedRegions)
send_region (ConnectedRegions, Socket)
receive_tuple (Socket, Area)
receive_tuple (Socket, Row)
receive_tuple (Socket, Column)
close_socket (Socket)
socket_accept_connectsocket_accept_connectSocketAcceptConnectsocket_accept_connectSocketAcceptConnectSocketAcceptConnect
open_socket_connectopen_socket_connectOpenSocketConnectopen_socket_connectOpenSocketConnectOpenSocketConnect,
close_socketclose_socketCloseSocketclose_socketCloseSocketCloseSocket,
get_socket_paramget_socket_paramGetSocketParamget_socket_paramGetSocketParamGetSocketParam,
set_socket_paramset_socket_paramSetSocketParamset_socket_paramSetSocketParamSetSocketParam,
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
Foundation