DX Infrastructure Manager

Expand all | Collapse all

Can't get a connection over the bus/hub

Jump to Best Answer
  • 1.  Can't get a connection over the bus/hub

    Posted 09-29-2015 10:45 AM

    I am trying to setup an connection to an hub over the bus.

    The remote hub is connected through an proxy.

     

    Problem is I can't even connect to my accessable hub.

    I can however connect to the controller.

    If I however want to connect to a different probe (for example cdm) or the Hub it will not work.

     

    How my code looks like:

                        string sid = string.Empty;

                        using (NimbusSession s = new NimbusSession("10.23.228.1", (int)NimbusPort.Controller))

                        {

                           

                            sid = s.Login(username, wachtwoord, true);

                            PDS reply = s.SendMessage(new Request("port_list"));

                        }

    This works fine.

    If i change the portnumber to the port of the hub I get the error:

    +$exception{"Failed to log in. Check user name and password."}System.Exception {Nimsoft.NimBUS.NimException}

     

    The username and password are the same that are used for the controller.

    It also loads for 30 seconds or so.. And if I fill in a different username and password (that are indeed incorrect) it fails within a second.

     

    I am using version 2.30.5101.2576 of the API.

     

    I would really appreciate some help.. I am stuck here all day now..



  • 2.  Re: Can't get a connection over the bus/hub

    Posted 09-29-2015 01:40 PM

    Hi,

     

    You'll need to do the login to the controller, and then open a separate session to the hub after that and do callbacks there.

     

    -jon



  • 3.  Re: Can't get a connection over the bus/hub

    Posted 09-30-2015 02:25 AM

    I knew that. But the problem is I can't connect to the hub for some reason.. I tried the following:

    - first connect to the controller, and then to the HUB using the SID:

    sid = s.Login(username, wachtwoord, true);

                            PDS reply = s.SendMessage(new Request("port_list")); //this works

                            NimbusSession sessionHub = new NimbusSession("/<domain>/<hub>/<robot>/hub", sid);

                            PDS hubs = sessionHub.SendMessage(new Request("gethubs"));

    - first connect to the controller and connec tot the hub using the sid, address and port

    sid = s.Login(username, wachtwoord, true);

                            PDS reply = s.SendMessage(new Request("port_list"));

                            NimbusSession sessiieHub = new NimbusSession("/<domain>/<hub>/<robot>/hub", (int)NimbusPort.Hub, sid);

                            PDS hubbs = sessiieHub.SendMessage(new Request("gethubs"));

     

    - then I tried to connect directly to the hub using different ways of using IP-adresses and names.. Nothing seem to work.



  • 4.  Re: Can't get a connection over the bus/hub

    Posted 09-30-2015 02:42 AM

    Hard to say without seeing the entire code, but here's a working example:

     

    string sid = string.Empty;
    
    
    using (NimbusSession s = new NimbusSession("controller")) 
    {
      sid = s.Login("user", "password", false);
    }
    
    
    using (NimbusSession s = new NimbusSession("/Domain/Hub/Robot/hub", sid))
    {
      PDS reply = s.SendMessage(new Request("gethubs"));
      Console.WriteLine(reply.ToString(true, 2));
    }
    


  • 5.  Re: Can't get a connection over the bus/hub

    Posted 09-30-2015 03:03 AM

    Hmm that code doesn't work on my machine.. If I create a new program. Copy-pasta the code. change username,password en the address of the session for the hub. Just doesn't work..

     

    I may have found a problem. If I connect to the controller using the address /Domain/Hub/Robot/controller

    I can't get a connection. If I connect to the same controller using the IP-adress it seems to work.



  • 6.  Re: Can't get a connection over the bus/hub

    Posted 09-30-2015 03:31 AM

    It sounds like an issue in UIM's name resolution. Are you running the code on a machine with the agent installed and active? There's some bugs in the SDK so it is pretty much required to do so.

     

    -jon



  • 7.  Re: Can't get a connection over the bus/hub

    Posted 09-30-2015 03:53 AM

    I did.

    I kinda solved it at the moment.. I just connect to the controller on IP adres, get a SID and then connect to the hub using the IP-adres, Port and the SID. And now I can collect the hub information etc.

    My code:

    using (NimbusSession s = new NimbusSession("10.23.228.1", (int)NimbusPort.Controller))

                        {

                            sid = s.Login(username, wachtwoord, true);

                            PDS reply = s.SendMessage(new Request("port_list"));

     

     

                            NimbusSession sessionHub = new NimbusSession("10.23.228.1", (int)NimbusPort.Hub, sid);

                            PDS hubbs = sessionHub.SendMessage(new Request("gethubs"));

     

     

                            PDS robots = sessionHub.SendMessage(new Request("getrobots"));

                        }



  • 8.  Re: Can't get a connection over the bus/hub

    Posted 09-30-2015 05:45 AM

    Problem now is. How can I get a connection over the bus to an other Hub?

    Is there an example for that? Using IP-adresses?



  • 9.  Re: Can't get a connection over the bus/hub

    Posted 09-30-2015 06:01 AM

    It doesn't differ from communicating with a local robot



  • 10.  Re: Can't get a connection over the bus/hub

    Posted 09-30-2015 06:56 AM

    Hmm I don't really get it working.

    If I try to connect to it as if I make a connection to a local robot it try's to reach it directly and not over the bus.

    This will fail, because the remote hub is not on the same LAN network as I am. Is there a way to use the bus to connect to a remote hub/controller.



  • 11.  Re: Can't get a connection over the bus/hub

    Posted 09-30-2015 07:15 AM

    I've never had a problem with it. Then again, I always use the nimbus address to define which robot it should connect to. My understanding is, that it is essentially the same as defining IP and port, it merely adds the step of doing "nametoip" callback to the controller first to resolve them.

     

    -jon



  • 12.  Re: Can't get a connection over the bus/hub

    Posted 09-30-2015 07:19 AM

    Hmm that explains it a bit. But there should be a way to connect to remote hubs over the bus right? It gets through a proxy which has tunnels to the remote hubs.

     

    Nick



  • 13.  Re: Can't get a connection over the bus/hub
    Best Answer

    Posted 09-30-2015 07:27 AM

    Now that I look at it, you can't connect to remote hubs with IP and port, you will have to use an overload of the NimbusSession that acceps the nimbusaddress parameter.

     

    -jon



  • 14.  Re: Can't get a connection over the bus/hub

    Posted 10-08-2015 04:41 AM

    Hello Jon,

     

    I did solve the problem, but forgot to answer.. There seems te bo a bug indeed in the Nimsoft SDK.

    When you connect to a machine on IP adres it will try to acces the robot/hub etc directly. So it will not use the tunnel.

    This happends even when you give it a SID.

    Also I can't resolve a name without being a robot myself..

     

    My idea was to create a form application anybody could run and use with their local account so you could see who did what and from what IP it accessed the callbacks.

     

    Because I don't want every PC as a robot I changed my plan and created a web application which retrieves the files and configs.

    Also created a ACL on the router so only the trusted PC's can access this web application to control the users.

     

    This fixed it..

    Thanks for your help with this.

     

    Do you have any idea when or if the bug will be solved?

     

    Kind regards,

    Nick



  • 15.  Re: Can't get a connection over the bus/hub

    Posted 10-08-2015 07:09 AM

    I haven't reported the bug myself, guess I could do that. Reporting bugs in the SDKs is a bit of a tedious process and it's hard to even get it to the developers. This hasn't bothered me really in the past so that's why I haven't reported it.

     

    Last February I reported another bug in the NimbusSession that had to do with initialization of SSL in some NimbusSession constructors, which bugged. It took about three months for CA support /dev fols to see the problem, but after that the devs fixed it and sent me a new build in about a week, so that was pretty fast. Funny thing is though, I queried what's the schedule for official release and asked for a change list.. well, I haven't received a message yet and the version they  sent me hasn't been released yet either.

     

    I might try and open a case with them later (I'm currently not at work). If you open one, I suggest you first create a simple program that demonstrates the problem and sent it over to them, source code and the binary as well.

     

    Also the actual reason for this is that the message header is not being built correctly when using the IP and port constructor for nimbusession.

     

    -jon