2)机器人一般做client,在示教器-程序编辑器,添加指令-communicate下找到SocketCreate,如下图
3)下图为机器人做client与相机通讯的一般步骤
SocketCreate socket1; //创建套接字
SocketConnect socket1,"192.168.0.2",8005; //连接server,这里需要设置server的ip和端口
TPWrite "connected success";//连接成功后输出信息
WHILE TRUE DO
!routine
SocketSend socket1Str:="Hello server";//向server发送请求
SocketReceivesocket1Str:=received_string;//从server接受数据字符串,并存储到received_string字符串
TPWrite "Server wrote - "+received_string;//写屏收到的字符串
END WHILE
4)如果通讯成功,机器人就能收到相机发送过来的字符串,举例如下,即x偏量1.23,y偏量4.56,角度7.89
快去试试你的机器人能不能连上相机吧!