Dashboard ur3e with HMI esa

I have an esa automation panel that communicates with a UR3e in dashboard port 29999… The robot receives the commands of break released, manual, automatic… but when should I read the response string. for example, after the commando is in remote control, the string that i receive is equal to 0.Following the esa script :

''connection parameters
Dim serverIPAddress
serverIPAddress = “192.168.100.20” 'server ip
Dim serverIPPort
serverIPPort = 29999 'server port
Dim TCPClientID
TCPClientID = -1 'initialize TCPClient ID

’ open client communication
sub openCLIENT()

' if client not exists -> create!
if (TCPClientID = -1) then
	TCPClientID = ESAHMI.ESAETH.TCPClient.OPEN(serverIPAddress, serverIPPort )
end if

ESAHMI.ESAMSGBOX "TCPClientID " & TCPClientID

end sub

'write command
sub wrstrcl ()

'check if client exists
if (TCPClientID = -1) then
ESAHMI.ESAMSGBOX “Client not exists”
exit sub
end if

Dim nChars
nChars = ESAHMI.ESAETH.TCPClient.WriteString(TCPClientID, "robotmode\n")
ESAHMI.ESAMSGBOX "TCPClient WriteString: " & nChars

end sub

'read a string
sub readstrcl()

'check if client exis
if (TCPClientID = -1) then 
	ESAHMI.ESAMSGBOX "Client not exists"
exit sub 
end if	

Dim readBuffer
	nChars = ESAHMI.ESAETH.TCPClient.ReadString (TCPClientID, readBuffer, 0)
if (nChars<>0) then
	ESAHMI.ESAMSGBOX "TCPClient ReadString: " & nChars & " : " & readBuffer
else
	ESAHMI.ESAMSGBOX "TCPClient ReadString: " & nChars
end if

end sub

'close client communication

sub close ()

'check if client exists
if (TCPClientID <> -1) then
	ESAHMI.ESAETH.TCPClient.Close TCPClientID 'close client
    TCPClientID = -1 'reset TCPClientID
	ESAHMI.ESAMSGBOX "Client closed"
else
	ESAHMI.ESAMSGBOX "Client already closed"
end if

end sub