YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Connection to the server lost. [-10723] PINET: No Connection. Options · View
Steve Clay
#1 Posted : Wednesday, October 05, 2011 9:58:42 AM
Rank: Newbie
Groups: Member

Joined: 10/4/2011
Posts: 2
Location: UK - West Yorkshire

Connection to the server lost. [-10723] PINET: No Connection.

The following example code works fine in our Dev & Systest environments.

However the 1st time it runs in our UAT environment, the call to pipoint.Data.RecordedValues() fails with the above message. Subsequent runs in our UAT environment work fine.

I am unable to replicate the error in our Dev environment.

I suspect that the 1st time it runs, at the point of the call to pipoint.Data.RecordedValues(), the piserver object is not fully setup? but then subsequent runs work fine? I am confused.

Is this a bug in the SDK? or bad code design on my part? Do I need to introduce a small delay prior to calling pipoint.Data.RecordedValues()?

I would appreciate any insight into how I could correct this problem.

Example code:


PISDK.PISDK pisdk = new PISDK.PISDK();
PISDK.Server piserver = pisdk.Servers["pidev"];

if (!piserver.Connected)
{
piserver.Open(String.Empty);
}

PISDK.PIPoint pipoint = piserver.PIPoints["Sinusoid"];

PISDK.PIValues pivalues = pipoint.Data.RecordedValues(new DateTime(2011,8,3),
new DateTime(2011,8,4),
PISDK.BoundaryTypeConstants.btInside,
"",
PISDK.FilteredViewConstants.fvRemoveFiltered,
null);



Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
caffreys_col
#2 Posted : Wednesday, October 05, 2011 11:04:17 AM
Rank: Advanced Member
Groups: Member

Joined: 4/6/2011
Posts: 40
Location: Grimsby UK
Ok dumb question first ...Is this code VBA? If so I generally define my server and then use the set command to point it at a specifc server. If you haven't already logged into the server with a user account then you may need to add that as well incase the data you are trying to retrieve doesn't allow world access.

Dim svr as PISDK.Server

Set svr = PISDK.Servers("pidev")
if svr.connected then
srv.close
endif
srv.open ("UDI=username; PWD=password")

where UDI is the username to connect to the PI server with, and PWD is the password.

I have run into trouble before where the point attributes wouldn't let me return data because the world access was disabled.

Try the above and see if that clears up your connection problems

Steve Clay
#3 Posted : Wednesday, October 05, 2011 11:59:31 AM
Rank: Newbie
Groups: Member

Joined: 10/4/2011
Posts: 2
Location: UK - West Yorkshire
Hi caffreys_col, thanks for the quick response.

The code is C#.

I don't think the problem is related to world access, as the code works fine the 2nd & subsequent times. It's only the 1st time it runs that causes the problem, which leads me to suspect that the server object has not been fully setup by the time I try to use it? Of course I might be barking up the wrong tree, as I am a C# & OSI PI newbie.

As I said in the OP the Dev & Systest environments have no problem at all. I've got people checking the UAT environmrnt to see if the SDK versions are the same etc, but I'm just trying to see if there is anything I can do to code round this problem.

Regards,
Steve.
caffreys_col
#4 Posted : Thursday, October 06, 2011 10:24:14 AM
Rank: Advanced Member
Groups: Member

Joined: 4/6/2011
Posts: 40
Location: Grimsby UK
Steve,

On your test system, do you have a user account in PI that has a blank username? Or does the system automatically create a trust login for you?

The only thing I can think of is that when you do the first call on the UAT server, it doesn't allow you to connect because you are not logged into the server. The server then assigns a trust login which is used when you try to access data the second time.

Have you tried putting in a username and password into the piserver.open line?? PI normally comes with a demo account called pidemo (blank password). You could try the following;
piserver.open("UID=pidemo; PWD=")

Or put in a valid account, just for testing

This is just a guess I'll admit but it might work.

wha72
#5 Posted : Thursday, April 05, 2012 5:07:30 PM
Rank: Newbie
Groups: Member

Joined: 3/20/2012
Posts: 1
Location: Edmonton, Alberta, Canada
Has anyone found a solution to this issue? I am seeing the exact same thing with using client tools, such as PI Datalink. The first reconnect fails, but all subsequent reconnects succeed.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.