RobotStudio event

Socket Programming with Virtual Controller

I would like to use socket messaging to communicate from an application running on a PC connected to my LAN to my robot program running on the virtual controller (running on the same PC or a different PC also connected to my LAN).

 

1) How do I get the Virtual Controller's IP Address so I can bind a socket to it?

 

2) How do I connect the Virtual Controller to my LAN?

Comments

  • Hi
    If you have both server and client on the same PC use the 127.0.0.1 localhost.
    IF you use you rapid code on both use this code snippert that checkes if the controller is a VC or not

     

    IF ROBOS() THEN (true if is a real controller. False if it is a VC

              SocketConnect my_socket, "163.34.138.153", 8888Time:=10;

              Bl_SocketConnected := TRUE;

              Num_VisionAlarmNo := 0;

    ELSE

              SocketConnect my_socket, "127.0.0.1", 8888Time:=10;

              Bl_SocketConnected := TRUE; Num_VisionAlarmNo := 0;

    ENDIF

     

    BR Klaus
    Best Regards

    Klaus Soenderhegn
    www.cadalysator.dk
  • I'm looking into the same issue now 10 years later...

    Has anyone made it work using Socket?

    Thanks,
  • Yes. I have programmed a simple socket connection using C++ and a virtual robot.
    ROS (Robot operating System) also uses a socket connection to control a abb robot.
    You can ask anything, just pm