Connect to the robot

Connect to a UR robot

Initialize a TCP communication with a robot. The Connect() method take the hostname (ur-xxx) of the robot or its IP address that you can find in the "About Dialog-Box" in PolyScope.

If this method is called with only the IP as parameter the XML-RPC server is started on port 50000 and the data streaming is enabled on Primary Port.

using UnderAutomation.UniversalRobots;
// Create a new UR instance
var ur = new UR();

The Connect() method can throw a InvalidLicenseException if your trial period is over or if your license key is invalid.

Connection parameters

The Connect() method has optionnal parameters that can be used to set up the connection. If none of the optional parameters are used, the data streaming takes place on the Primary Port, the XML-RPC server starts on port 50000 and the robot is pinged at the connection.

// Initialize a connection to the robot
public void Connect(string ip, bool enableDataStreaming = true, DataStreamingPorts dataStreamingPort = DataStreamingPorts.PrimaryClient, bool enableXmlRpcServer = true, int xmlRpcServerPort = 50000, bool pingRobotBeforeConnect = true, bool enableSSH = true, bool enableSFTP = true, string login = "ur", string password = "easybot")
// Create a new UR instance
var ur = new UR();
ur.Connect("" // IP of the robot
,true // Enable Data Streaming
,DataStreamingPorts.SecondaryClient // Use secondary port for data streaming
,true // Enable XML-RPC
,40000 // Use local port 40000 instead of 50000 to host the XML-RPC server
,false // Do not ping the robot
Members of DataStreamingPorts :
public enum DataStreamingPorts {
// The default port that allow reading data and sending URScript
PrimaryClient = 30001,
// This port can only read data. It is unable to send URScript.
PrimaryClientReadOnly = 30011,
// The secondary port with same features as PrimaryClient
SecondaryClient = 30002,
// A secondary port that can only read data. It is unable to send URScript.
SecondaryClientReadOnly = 30012


The Disconnect() method stops all services including the data streaming and the XML-RPC server.

// Create a new UR instance
var ur = new UR();
// ...
// Stop connection

66 Avenue des Champs-Elysées
75008 Paris

© 2021 UnderAutomation - UnderAutomation通用机器人.NET通信SDK(软件开发工具包)提供了创建定制的.NET核心、.NET框架和.NET标准应用程序的能力,可以与每个UR机器人通信。提供了可用于Windows、Mac OS和Linux、LabView、Node.js和Python的现成例子。它使用TCP/IP仪表板服务器和XML-RPC来远程控制机器人,并使用客户端接口来接收和解码数据流。