Dear all,
Once again, another difficult problem to solve...
I'm trying to communicate over TCP/IP with the robot. Currently, I'm using a Windows PC with KROSET (Robot-Side) and an Ubuntu Linux PC from which I am starting a TCP/IP client.
On the Robot-Side, I am using the following function found in the Kawasaki TCP/IP manual to recieve a string data.
.PROGRAM recv (.length) ; Recieves data of .length
.num = 0
TCP_RECV rret, sock_id, $recv_buf[0], .num, tout_rec, .length
IF rret < 0 THEN
PRINT "**ERROR: Something went wrong recieving the message.**"
PRINT "Error Code: ", rret
$recv_buf[0] = "000"
ELSE
IF .num > 0 THEN
PRINT $recv_buf[0]
$recieved_msg = $recv_buf[0]
ELSE
$recv_buf[0] = "000"
END
END
.END
Display More
I am using this function twice and subsequently to recieve two messages: a header and a command. Let's say that the header has 19 characters and the command has 85. So, I am doing the following in my communication program:
.PROGRAM Communication ()
WHILE client_connected DO
; Receive the header data (19 bytes)
CALL recv(19)
; Do something...
; Recieve the command data (85 bytes)
CALL recv(85)
; Wait for some time
TWAIT 0.01
END
.END
Display More
From the client side, I have a python script sending the data all together, hence the header and command are sent in a single string.
On the second CALL recv, I am receiving the error **ERROR: Something went wrong recieving the message.** because in recv() the TCP_RECV returns rret < 0.
The error code in rret = -34024. What is this error all about?
I tried to cross-check the string that I am sending and other possible bugs on the client side... With just one recv() in the Communication program, I don't get any error!
Please help me guys. Thanks in advance.