Start a topic
With the exception of Windchill, The PTC Community is on read-only status until April 6 in preparation for moving our community to a new platform. Learn more here
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The PTC Community is on temporary read only status in preparation for moving our community to a new platform. Learn more here

Translate the entire conversation x

Creo VB API cannot connect when I switch network.

LBilén
8-Gravel

Creo VB API cannot connect when I switch network.

I am using Creo Parametric Release 8.0 and Datecode 8.0.12.0

I have some Creo VB API program. All work fine if you stay on same network all the time. If I start Creo with LAN (eternet) connection and take my laptop to a conference room with WiFi. Then I cannot connect with Creo API.

Here are the errors that I faced
pfcExceptions::XToolkitNotFound

Code:
Public Shared Function ACon(sender As System.Object)
'Connect to Creo... first with last saved connection data...
Dim cs As String = $"c:\ptc\Creo8\connection_string.ini"
Try
If File.Exists(cs) Then connection_id = File.ReadAllLines(cs).FirstOrDefault()?.Trim()
local_connId = ConId.Create(connection_id)
asyncConnection = ccon.ConnectById(local_connId, ".", 30)
Catch ex As Exception
If asyncConnection IsNot Nothing AndAlso asyncConnection.IsRunning Then
asyncConnection.Disconnect(1)
End If
End Try
'If it did not work above, try to connect with std connection string, if failed kill pfclscom and it might work next loop..
If asyncConnection Is Nothing Then
System.Threading.Thread.Sleep(500)
Try
If asyncConnection Is Nothing OrElse Not asyncConnection.IsRunning Then
asyncConnection = (New CCpfcAsyncConnection).Connect(Nothing, Nothing, Nothing, 5)
End If
Catch ex2 As Exception
For Each p In Process.GetProcessesByName("pfclscom")
Try : p.Kill() : Catch : End Try
Next
End Try
End If
'Last chance....
If asyncConnection Is Nothing Then
System.Threading.Thread.Sleep(500)
Try
If asyncConnection Is Nothing OrElse Not asyncConnection.IsRunning Then
asyncConnection = (New CCpfcAsyncConnection).Connect(Nothing, Nothing, Nothing, 5)
End If
Catch ex2 As Exception
Return asyncConnection
Exit Function
End Try
End If
Try
File.WriteAllText(cs, asyncConnection.GetConnectionId.ExternalRep & Environment.NewLine)
Catch
End Try
Return asyncConnection
End Function
ACCEPTED SOLUTION

Accepted Solutions
remy
21-Topaz I
(To:LBilén)

Thank you for your confirmation.
After searching the knowledge base, I have found this article : https://www.ptc.com/en/support/article/CS287881

It says that The IP of the network driver is part of the session signature when the asynchronous application is started. 

The article is about the Java Object Toolkit flavor but the cause remains.

Consequently the solution consists in :
  1. detecting the change of ip ie the disconnection (which your code already does)
  2. reconnect

 

View solution in original post

6 REPLIES 6
remy
21-Topaz I
(To:LBilén)

Hi 

VB API and Toolkit at large leverage existing functionality.
Can you confirm that switching network keeps the session stable wimply with Creo Parametric ?

what's the behavior when you have, let's say a model in session, then change network ?

LBilén
8-Gravel
(To:remy)

When I change networks, everything works fine in Creo. I can check in and out. The license is OK. Downloading .prt and .asm works. It's just the VB API that has crashed.

remy
21-Topaz I
(To:LBilén)

Thank you for your confirmation.
After searching the knowledge base, I have found this article : https://www.ptc.com/en/support/article/CS287881

It says that The IP of the network driver is part of the session signature when the asynchronous application is started. 

The article is about the Java Object Toolkit flavor but the cause remains.

Consequently the solution consists in :
  1. detecting the change of ip ie the disconnection (which your code already does)
  2. reconnect

 

LBilén
8-Gravel
(To:remy)

Ok,

So it is only possible to:

Reconnect using the same network driver.
Restart Creo to get a new session signature.

(Copy from https://www.ptc.com/en/support/article/CS287881)

These are the two ways I've also gotten it to work. No other way has worked.

 

I had hoped that there was a solution to the problem, but it seems there is not.

RPN
18-Opal
18-Opal
(To:remy)

I have the same issues with asyn toolkit apps, for me this is not the root cause. And I don’t understand why the IP changes, because you are connected to the local machine, and why here the IP should change. I guess the RPC socket will close, and this will fire an event and will finally disconnect the session.
And sometimes reconnect without Creo restart is not possible, and this is a bug in my opinion. Because this may have an impact on your session data. 

remy
21-Topaz I
(To:RPN)

Your findings are fair and i understand that in our day and age of mobility this only makes sense.
To keep things in context, Creo is 40 years old and was initially designed for workstations.

Initially CAD users weren't supposed to move around with their hardware, let alone have a wireless connection.
So more than a bug it is an evolution and by ways of consequence your filing a enhancement request is more than welcome.

Announcements



Top Tags