DOBOT CR5 User Guide 6 Program Language
Issue V3.5.3.1 (2020-05-09) User Guide Copyright © Yuejiang Technology Co., Ltd
97
0: Sending data is successful
1: Sending data is failed
Please refer to Program 6.1 and Program 6.2
Table 6.49 Release TCP network command
0: Releasing TCP is successful
1: Releasing TCP is failed
Please refer to Program 6.1 and Program 6.2
NOTICE
Only a single TCP connection is supported. Please start the server before connecting a
client. Please shut down the client before disconnection, to avoid re-connection failure
since the server port is not released in time.
Program 6.1 TCP server demo
local ip="192.168.5.1" // IP address of the robot as a server
local port=6001 // Server port
local err=0
local socket=0
err, socket = TCPCreate(true, ip, port)
if err == 0 then
err = TCPStart(socket, 0)
if err == 0 then
local RecBuf
while true do
TCPWrite(socket, "tcp server test") // Server sends data to client
err, RecBuf = TCPRead(socket,0,"string") // Server receives the data from client
if err == 0 then
Go(P1) //Start to run motion commands after the server receives data
Go(P2)
print(buf)