Kawasaki: how to check socket status before connecting

Right now when i setup an TCP connection with the kawasaki robot and the programthrows an error the socketport stays open. When i try to restart the program is gives an error “(E4055) TCP)Cannot create a socket.” becouse the old crashed socket is still active.

i have to close the old crashed TCP connection with TCP_END_LISTEN before i can start the program again, else it will trow an error that that port has already been taken. if i call TCP_END_LISTEN and the port isnt closed it will throw an error as well

My question is: is there some way to check if an port is already open without the robot completely shutting down because it threw an error. Second question: is there some form of try throw catch mechanism in AS programming that can be used for error handeling?

Yes there is, you can use TCP_STATUS to get the status of a socket. But as far as I know the Kawasaki robots at SMR don’t support the function.

As far I could find this is also not possible. If something like this exists in should be mentioned in the AS language reference manual.

I may have a solution for your problem. It is possible to run multiple script at once in the Kawasaki (see process control program). Maybe this script keeps running after the error. If this is the case then you can put the communication loop in there and the movements in the “normal” program. In this way if an error occurs in the “normal” program the process control program keeps running and keeps the TCP connection active.