I'm not able to see an issue with the piece of code that you have pasted here. Maybe you could open a bug report with halcust attached and repeatable situation that I can look at?
I meant that file you were looking it, forgot the actual name sorry about that.
But that file, if you change the IP to the correct one, does it then connect?...