[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference abbott::teamlinks_windows

Title:TeamLinks for Windows
Notice:Kit and ECO locations: See replies to note 8.o note 8.
Moderator:ORION::chayna.zko.dec.com::tamara::eppesAN
Created:Mon Aug 28 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2238
Total number of notes:9650

2111.0. "Invalid Session-ID within an Application" by ATZIS2::EHRLICH_K (Never met a Lady like her before!) Mon Apr 07 1997 06:57

    Hi,
    
          We have a Teamlinks-Customer-Application (Visual Basic) which
          connects to the filecabinet-server, does some work and then
          disconnects again. On calling this application more than about
          20 times following error occurs:

             The CfcOpenCabinet-call still succeeds,
             but the subsequent call to DocumentOpenSession doesn't
          return a valid SessionID anymore.

          I have isolated the problem in the attached Visual-Basic
          module. Just invoke the exe-files about 20 times and the error
          occurs.
          It 'worked' on several PCs. To recover, sometimes restarting
          Teamlinks is enough, sometimes restarting the PC is necessary.
          On the filecab-server no error is reported and no faulty
          connections are left. It seems to be a problem of TeamLinks.

          TeamLinks V2.7-001 English and/or V2.5-004 German, ALL-IN-1 V3.2
    MTIA for your kind support,
    Cheers,
    Charly

Global CfcSessionId As Long
Global SessionId As Integer

Declare Function CfcOpenCabinet Lib "CFC.DLL" (Session&, ByVal app&, ByVal openmode%, ByVal callback&, ByVal callbackparms&) As Integer
Declare Function CfcCloseCabinet Lib "CFC.DLL" (ByVal Session&) As Integer
Declare Function DocumentOpenSession Lib "FILECAB.DLL" (ByVal Handle%, ByVal SessionId&, ByVal AppName As Any, ByVal Server As Any, ByVal User As Any, ByVal Password As Any, ByVal Transport As Any) As Integer
Declare Function CfcGetErrorText Lib "CFC.DLL" (ByVal errorcode%, ByVal msgbuffer$, ByVal sizeofbuffer%) As Integer
Global Const CFC_NORMAL = 1

Sub CFCClose ()

  Dim Sts As Integer

  If CfcSessionId <= 0 Then End

  Sts = CfcCloseCabinet(CfcSessionId)
  
End Sub

Sub CFCOpen ()

'   Connect to the CFC

Dim Sts As Integer

Sts = CfcOpenCabinet(CfcSessionId, ByVal 0&, ByVal CFC_OPEN_DEFERRED, ByVal 0&, ByVal 0&)
If Sts <> CFC_NORMAL Or CfcSessionId = 0 Then
    OutputCfcErrorText (Sts)
    Exit Sub
End If

SessionId = DocumentOpenSession(0&, CfcSessionId, 0&, 1&, 0&, 0&, 0&)
If SessionId = 0 Then
    Screen.MousePointer = 1
    MsgBox "Fehler beim Verbinden zur Ablage", MB_IconStop, ApplTitle
    Exit Sub
End If

MsgBox "successfull connection"

End Sub

Sub Main ()

' Teamlinks must give us an external Identifier.
' For testing supply hard-coded identifiers.

Dim Count%, RetCod

'Do
    CFCOpen
'    RetCod = MsgBox(CStr(Count), 1)
    CFCClose

'    If RetCod <> 1 Then End
'    Count = Count + 1
'Loop

End

End Sub

Sub OutputCfcErrorText (errorcode As Integer)

' gibt eine Messagebox mit dem Cfc-Fehler aus
' input:    CfcErrorCode


    Dim ErrorText As String
    Dim S%
    ErrorText = Space$(255)

    S% = CfcGetErrorText(errorcode, ByVal ErrorText, Len(ErrorText))
    
    DoEvents
    Screen.MousePointer = 1
    MsgBox "CFC Fehler: " & Trim(ErrorText), MB_IconExclamation, ApplTitle

End Sub
    
T.RTitleUserPersonal
Name
DateLines
2111.1Found it.XANADU::cascobay.zko.dec.com::TAMARA::STJEANBob St.JeanMon Apr 07 1997 15:4715
Charly,

Ich habe den Fehler gefunden!  ;-)

The program doesn't ever seem to call DocumentCloseSession.  This 
closes the session to Filecab.dll.  DocumentCloseSesson would not 
close the CFC session if it was provided in the parameter to
DocumentOpenSession.

Eventually you would just run out of memory if you never closed
the Filecab.dll session.

Bob


2111.2oouuuppps!ATZIS2::EHRLICH_KNever met a Lady like her before!Tue Apr 08 1997 07:3915