1.机器人一般做client,在示教器-程序编辑器,添加指令-communicate下找到SocketCreate:
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
3.如果通讯成功,机器人就能收到相机发送过来的字符串。
4.机器人与相机一般采用socket通讯(TCP/IP)。所以机器人需要有pc-interface选项。