Catalyst NNTP service problems 
Author Message
 Catalyst NNTP service problems

Would someone be so kind to explain what I am doing wrong in the following
code. Problems I am experiancing:
1) Download a contigious block of articles then fails
- Seeding Current Article with a high value give same result
2) Frequently returns with error 26520 (posting) !!!?

Thanks in advance!

Charles

I have provided the entire function below:
---------------------------------------

GetNewsGroupArticles    FUNCTION(HostName,GroupName)

ExportFile          EQUATE('Export.TXT'   )
NewsGroupOCXFile    EQUATE('CSNWS32.OCX'  )
CatalystNewsOLEName EQUATE('Catalyst.NewsClientCtrl.1') ! Find OLEName using
RegEdit.EXE,
                                                        ! then look under
HKey_Classes_Root
MaxArticleSize      EQUATE(          64000)
Max_Path            EQUATE(            260)
CurrentDirectory    CSTRING(      Max_Path)
WindowsDirectory    CSTRING(      Max_Path)
TempString1         STRING(       Max_Path)
TempString2         STRING(       Max_Path)
ArticleText         CSTRING(MaxArticleSize)
Article             STRING(            128)
ErrorText           STRING(            128)
OLECheckString      STRING(              2)

CurrentArticle      LONG
FirstArticle        LONG
LastArticle         LONG
ArticleCount        LONG
ArticlesWritten     LONG
TempLong            LONG

OutputFile
FILE,DRIVER('DOS'),NAME(ExportFile),PRE(OutputFile),CREATE
OutputFileRecord       Record
Text                      CSTRING(MaxArticleSize)
                       .
                    .

OLEWindow           WINDOW('Get NewsGroup Article'),AT(,,200,50),GRAY
                       STRING('HostName :' ),RIGHT,AT( 1, 1,45,10);

                       STRING('GroupName :'),RIGHT,AT( 1,11,45,10);

                       STRING('File Name :'),RIGHT,AT( 1,21,45,10);
STRING(ExportFile),AT(50,21,160,10)
                       STRING('Article# :' ),RIGHT,AT( 1,31,45,10);

                       STRING('Errors :'   ),RIGHT,AT( 1,41,45,10);

                       OLE,USE(?CatalystOLEObject),Hide
                       .
                    .

        CODE

    !-- Initialization

        Article         = '0 of ?'
        ArticlesWritten = 0

        Create(OutputFile)
           if ErrorCode() then Stop(Clip(Error()) & ' creating Output File '
& ExportFile).

    !-- Create OLE Object, if necessary, Install and register OCX NewsGroup
Service

        Open(OLEWindow)
        Display

        ?CatalystOLEObject{PROP:Create } = CatalystNewsOLEName
           if ErrorCode() then Stop(Clip(Error()) & ' Creating OLE Object').

        OLECheckString = Upper(?CatalystOLEObject{'Article'})
           if (OLECheckString = 'NO')
              TempLong = Max_Path
              if not GetCurrentDirectory(TempLong,Address(CurrentDirectory))
then Stop('Error getting CurrentDirectory').
              if not GetWindowsDirectory(Address(WindowsDirectory),TempLong)
then Stop('Error getting WindowsDirectory').

              TempString1 = Upper(clip(CurrentDirectory) & '\' &
NewsGroupOCXFile)
              TempString2 = Upper(clip(WindowsDirectory) & '\' &
NewsGroupOCXFile)
              if Exists(TempString1)
                 Copy(TempString1,TempString2)
                 if ErrorCode() then Stop(Clip(Error()) & ' copying file ' &
Clip(TempString1) & ' to ' & Clip(TempString2)).
              else
                 Halt(0,'File ' & Clip(TempString1) & ' was not found
initializing NewsGroup OCX service')
              .

              TempString1 = Upper(Clip(CurrentDirectory) & '\RegSvr32.EXE')
              if Exists(TempString1)
                 Run(Clip(TempString1) & ' ' & Clip(TempString2),1)
                 if ErrorCode() then Stop(Clip(Error()) & ' Running ' &
Clip(TempString1)).
              else
                 Halt(0,'File ' & Clip(TempString1) & ' was not found
registering NewsGroup OCX service')
              .

              ?CatalystOLEObject{PROP:Create } = CatalystNewsOLEName
                 if ErrorCode() then Stop(Clip(Error()) & ' Creating OLE
Object, after trying to install OCX service').
           .

    !-- Retreive Desired Article

        ?CatalystOLEObject{'Blocking' } = TRUE
        ?CatalystOLEObject{'HostName' } = HostName  ! Establish connection
with news server
        ?CatalystOLEObject{'Action'   } = NNTP_ACTION_CONNECT
           if ?CatalystOLEObject{'LastError'} <> 0 then Return('Error ' &
?CatalystOLEObject{'LastError'} & ' Connecting to ' & HostName).

!!!        ?CatalystOLEObject{'Blocking' } = FALSE
        ?CatalystOLEObject{'GroupName'} = GroupName ! Also causes
FirstArticle & LastArticle to be updated
           if ?CatalystOLEObject{'LastError'} <> 0 then Return('Error ' &
?CatalystOLEObject{'LastError'} & ' Retreiving GroupName ' & GroupName).

    !-- Write all available articles to file

        FirstArticle   = ?CatalystOLEObject{'FirstArticle'} - 1
        LastArticle    = ?CatalystOLEObject{'LastArticle' }
        ArticleCount   = LastArticle - FirstArticle
        CurrentArticle = 1

        loop

           CurrentArticle += 1
           if CurrentArticle > ArticleCount then Break.
           Article = CurrentArticle & ' of ' & ArticleCount & ' <123>' &
FirstArticle & ',' & LastArticle & '<125>'
           Display

           ?CatalystOLEObject{'Article'} = FirstArticle + CurrentArticle
           if ?CatalystOLEObject{'LastError'} = 0

              ?CatalystOLEObject{'Action'} = NNTP_ACTION_GETARTICLE
                 if ?CatalystOLEObject{'LastError'} <> 0 then Return('Error
' & ?CatalystOLEObject{'LastError'} & ' Getting Article ' & FirstArticle +
CurrentArticle).
              Clear(OutputFile:Text,0)
              if ?CatalystOLEObject{'RecvNext'}

                 OutputFile:Text = OutputFile:Text & '<0CCh,0Dh,0Ah>'
                 OutputFile:Text = OutputFile:Text &
?CatalystOLEObject{'MessageId'} & '<0Dh,0Ah>'
                 OutputFile:Text = OutputFile:Text & '<0CEh,0Dh,0Ah>'
                 loop
                    ?CatalystOLEObject{'RecvLen'} = 256 ! Must continually
maintain RecvLen's value, and behavior is very sensitive to this value!?
                    OutputFile:Text               = OutputFile:Text &
?CatalystOLEObject{'RecvData'}
                    if (?CatalystOLEObject{'RecvNext'} = 0) then break.
                 .
                 OutputFile:Text = OutputFile:Text & '<0B9h,0Dh,0Ah>'

                 ArticlesWritten += 1
                 Open(  OutputFile)
                    if ErrorCode() then Stop(Clip(Error()) & ' opening
Output File ' & ExportFile).
                 Set(   OutputFile)
                 Append(OutputFile,Len(OutputFile:Text))
                 Close( OutputFile)
              else
                 ErrorText = 'Article ' & CurrentArticle & ' Returned Empty'
                 Display
              .
           else
              if ?CatalystOLEObject{'LastError'} = ERROR_NNTP_BADARTICLE
                 ErrorText = 'Article ' & CurrentArticle & ' is reported to
be a bad article'
                 Display
              else
                 Return('Error ' & ?CatalystOLEObject{'LastError'} & '
Setting Article = ' & FirstArticle + CurrentArticle)
              .
           .
        .

    !-- Close up shop

        ?CatalystOLEObject{'Action'} = NNTP_ACTION_DISCONNECT
           if ?CatalystOLEObject{'LastError'} <> 0 then Return('Error  ' &
?CatalystOLEObject{'LastError'} & ' Disconnecting from news server').
        Close(OLEWindow)

    !-- Done

        Return(ArticlesWritten)



Sat, 31 May 2003 01:53:08 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Catalyst problems

2. Catalyst problem

3. catalyst problem c5smtp

4. Catalyst problem

5. Problems using Catalyst OCX in Clarion 5

6. Problem running NNTP example from docs.

7. VA Smalltalk Google Web Service Service Client and Server Simulator Example

8. New Services from Python Professional Services, Inc

9. ANN: New Services from Python Professional Services, Inc.

10. New Services from Python Professional Services, Inc

11. Catalyst Socket Tools and Clarion4

 

 
Powered by phpBB® Forum Software