DOBOT CR5 User Guide 6 Program Language
Issue V3.5.3.1 (2020-05-09) User Guide Copyright © Yuejiang Technology Co., Ltd
99
else
print("Create failed ".. err)
end
TCPDestroy(socket)
else
print("Create failed ".. err)
end
UDP
Table 6.50 Create UDP network command
err, socket = UDPCreate(isServer, IP, port)
Create a UDP network
Only a single connection is supported
isServer: Whether to create a server. 0: Create a client; 1: Create a server
IP: IP address of the server, which is in the same network segment of the client without conflict
port: Server port
When the robot is set as a server, port cannot be set to 502 or 8080. Otherwise, it will be in
conflict with the Modbus default port or the port used in the conveyor tracking application,
causing the creation to fail
err:
0: The UDP network is created successfully
1: The UDP network is created failed
socket: Socket object
Please refer to Program 6.3 and Program 6.4
Table 6.51 Receive data command
err, Recbuf = UDPRead(socket, timeout, type)
The robot as a client receives data from a server
The robot as a server receives data from a client
socket: socket object
timeout: Receiving timeout. Unit: s. If timeout is 0 or not set, this command is a block reading.
Namely, the program will not continue to run until receiving data is complete. If not, after
exceeding the timeout, the program will continue to run regardless of whether receiving data is
complete
type: Buffer type. If type is not set, the buffer format of RecBuf is a table. If type is set to string,
the buffer format is a string