TCPDevice
Defines an In-Sight spreadsheet cell as a TCP/IP device (client or server), which opens a connection between the In-Sight vision system and another TCP/IP device for sharing data over the network. Once a TCP/IP connection has been established, data is communicated using the ReadDevice, WriteDevice, and QueryDevice functions. For more information, see ReadDevice, WriteDevice and QueryDevice.
If the TCPDevice function initiates the communication with another TCP/IP device on the network, then the cell is the TCP/IP client. If the TCPDevice function waits for the communication to be received from another TCP/IP device on the network, then the cell is the TCP/IP server.
- TCPDevice generates an event when it receives a packet; this updates the spreadsheet.
- To establish a TCP/IP device connection between two In-Sight vision systems, both must be Online.
TCPDevice Inputs
Syntax: TCPDevice(Host Name,Port,Protocol,Packet Type,Timeout,Terminator)
Specifies the name of the TCP/IP server device with which to establish a connection, if the cell containing the TCPDevice function will be the client. Note:
|
|||||||||||||||
Note: A valid Port assignment is any
unused number between 1 and 65535, except for ports
used for In-Sight communications. In-Sight Emulator users should always
assign Port numbers 3000 (the default) and higher to prevent potential
conflicts with ports reserved by services on the PC. For more information, see In-Sight Ports.
|
|||||||||||||||
The network protocol to use when communicating between an In-Sight vision system and other TCP/IP devices on the network. In-Sight vision systems currently only support the standard TCP/IP protocol.
|
|||||||||||||||
Defines the formatting of the data string communicated between an In-Sight vision system and another TCP/IP device.
Note:
|
|||||||||||||||
The number of milliseconds (100 to 15000; default = 1000) to wait for a TCP/IP connection to be established before aborting the connection attempt. This parameter only applies when the TCPDevice function is in a cell defined as a TCP/IP client. |
|||||||||||||||
Specifies the ASCII character (0 to 255) to be used when String with Customer Terminator or Binary with Customer Terminator is specified for the Packet Type. |
TCPDevice Outputs
Returns |
A Device data structure. Returns #ERR if any of the input parameters are invalid, or when the Timeout is exceeded. Note: Up to 12 Device structures can be inserted into a single job.
|
Results |
When the function is inserted into a cell, an additional function will be automatically inserted in the adjacent cell to the right:
|
TCPDevice Example
An In-Sight host vision system named SYSTEM0 is configured as follows:
A3=TCPDevice("SYSTEM1",3000,0,0,300)
B3=WriteDevice($A$0,A3,C3)
A second host system, named SYSTEM1, includes the TCP/IP server and is configured as follows:
A4=TCPDevice("",3000,0,0,300)
B4=ReadDevice(A4)
Both systems are Online. Whenever the default image in cell $A$0 on SYSTEM0 is acquired, the TCP/IP client in cell A3 will establish a connection with the TCP/IP server in cell A4 on SYSTEM1 at Port 3000. The WriteDevice function in cell B3 on SYSTEM0 will then export the data in cell C3 to the ReadDevice function in cell B4 on SYSTEM1.