Connect to controller

HI.
I have a minor problem with connecting to controller.
If my HMI is opened before the robot is started up it won’t connect, but if my HMI has got connection to controller and i reboot th controller it will connect again afted the reboot. Strange??

I use a timer with 2 sek to see

If robotController.Connected = FALSE Then

scn = New NetworkScanner

robGuid = New System.Guid(RobotSytemGUID)

robot1 = scn.Find(robGuid)

robotController = New Controller(robot1)

robotController.Logon(UserInfo.DefaultUser)

Any idears???

BR Klaus

Does it make any difference if you call scan before you call find?

Have you tried the overloaded version of Find that has WaitTime and Retries parameters?

Or maybe you could use the NetworkWatcher class to notify you when your controller(s) connect or disconnect?