[news.software.anu-news] Problems accessing server under V58a

elsen%kulesat.uucp@BLEKUL60.BITNET (Marc Elsen) (07/30/89)

  I just installed V58A on one of my client nodes.The conversion
  towards news.groups and news.items went on without any problems.
     
  However it is no longer possible to read any article (resident on the server).
  Following is the error message I get :
     
          Connecting to NEWS SERVER on node esat...
          ERROR-Cannot connect to NEWS SERVER on node esat
          ERROR display cannot access item text.
     
! esat being the decnet node name of the server
     
  Protocol being used is DECnet.It seems that due to the relative 'quickness'
  with which these messages appear I seem to be able to conclude that
  no real DECnet link is even started.
  I sometimes noticed this kind of behaviour using  V5.7 too but then one
  could often recover from this situation by issuing a read request for
  the same article again immediately after the first one.
     
  I copied V58A directly from ANU using PSI_COPY,VAXC 2.4 and VMS v5.1 being
  used.
  Perhaps some updates to v58a were ever posted (must admit I 've been
  out of things for a while lately) ?
     
  Thanks for any help ,
     
     
  Marc Elsen (System Manager/Software Engineer)
  Katholieke Universiteit Leuven
  Dep. E.S.A.T.
  Kard. Mercierlaan 94
  3030 HEVERLEE
  Belgium
              tel. 32(0)16220931(ext. 1080)
     
               EMAIL : elsen@esat.kuleuven.ac.be
     
                       ...!kulcs!kulesat!elsen (UUCP)
                       elsen%kulesat.uucp@blekul60 (BITNET)
                       psi%02062166012::elsen  (PSI MAIL)
     

gih900@UUNET.UU.NET (Geoff Huston) (08/02/89)

Marc Elsen writes:
     
>  I just installed V58A on one of my client nodes.The conversion
>  towards news.groups and news.items went on without any problems.
>
>  However it is no longer possible to read any article (resident on the
 server).
>  Following is the error message I get :
>
>          Connecting to NEWS SERVER on node esat...
>          ERROR-Cannot connect to NEWS SERVER on node esat
>          ERROR display cannot access item text.
>
     
I got these too as soon as the local site moved to VMS V5.0 and VAX C V3.0.
     
SO.. I rewrote the i/o drivers in NEWSREMCLIENT.C to aviod the use of the
SYS$HIBER and SYS$WAKE calls (there's something funny going on there) and
rewrote it as signal and alarm calls.
     
Here's the modified code:
     
#module NEWSREMCLIENT "V5.9"
     
#include "newsinclude.h"
#include "newsdefine.h"
#include "newsextern.h"
#include iodef
#include signal
     
#define CMUTCP     1
#define WINTCP     2
#define SRITCP     3
     
#ifdef SRI
#define SRI	   1
#else
#ifdef TWG
#define TWG        1
#endif
#endif
     
#if TWG || SRI
#include <types.h>
#include <socket.h>
#include <netdb.h>
#include <in.h>
#include <inetiodef.h>
#define NNTP_PORT       (119)
struct hostent *dest_host;
struct sockaddr_in data_socket = {0};
#endif
     
#define CLIENT_TIMER 500
#define RESP_TIMER 300
#define TMP_FILE_NAME "SYS$SCRATCH:NEWS_%X_NNTP.TMP"
#define TMP_HEAD_NAME "SYS$SCRATCH:NEWS_%X_NNTPH.TMP"
#define X_BUF_SIZE 1024
#define MAX_NNTP_SIZE 1024
     
char client_msg[132];
char get_server_title[132];
int  get_server_size;
     
static
char net_open_chan[20] = {""},
     ibuf[X_BUF_SIZE],
     xbuf[X_BUF_SIZE + 1],
     sav_id[256] = {""},
     sav_idh[256] = {""},
     scratch_file[256] = {""},
     scratch_head[256] = {""},
     *rptr;
     
static
unsigned short net_chan,
               trm;
     
static
int net_read_status = 0,
    hiber_state = 0,
    cmd_code,
    net_proto = 0;
     
static
struct iosb {
    unsigned short iostatus;
    unsigned short iosize;
    int netinfo;
    } read_iosb;
     
static
struct nol {
    char *nodename;
    char *taskname;
    struct nol *next;
    } *nh = 0;
     
/*
 *  nntp_write
 *
 *  Synchronous write of a string to the net channel
 */
     
static
nntp_write(b)
  char *b;
{
  static char obuf[512];
  struct iosb write_iosb;
  int sts;
     
  strcpy(obuf,b);
  strcat(obuf,"\r\n");
  sts = sys$qiow(0,net_chan,IO$_WRITEVBLK,&write_iosb,0,0,obuf,strlen(obuf),
                 0,(net_proto == CMUTCP),0,0);
     
  if (!(sts & 1) || (!(write_iosb.iostatus & 1))) {
    close_net();
    sprintf(client_msg,"NNTP: Lost connection to Server: %s",net_open_chan);
    net_read_status = 0;
    return(0);
    }
  return(1);
}
     
/*
 *  nntp_read
 *
 *  Timed read of the net channel for a full line
 */
     
jmp_buf nntp_env;
     
cancel_nntp_read()
{
  close_net();
  sprintf(client_msg,"NNTP: Lost connection to Server: %s",net_open_chan);
  longjmp(nntp_env,1);
}
     
nntp_read(b,timer)
  char *b;
  int timer;
{
  static char ibuf[X_BUF_SIZE + 1];
  struct iosb r_iosb;
  char *cp, *rp;
  int sts;
     
  *b = '\0';
  if (setjmp(nntp_env)) return(0);
  signal(SIGALRM,cancel_nntp_read);
  alarm(timer);
  sts = sys$qiow(0,net_chan,IO$_READVBLK,&r_iosb,0,0,ibuf,X_BUF_SIZE,0,0,0,0);
  alarm(0);
  if (!(sts & 1) || (!(r_iosb.iostatus & 1))) {
    close_net();
    sprintf(client_msg,"NNTP: Lost connection to Server: %s",net_open_chan);
    return(0);
    }
  ibuf[r_iosb.iosize] = '\0';
  rp = ibuf;
  do {
    if (cp = strchr(rp,'\r')) *cp++ = '\0';
    strcat(b,rp);
    rp = cp;
    } while(rp);
  return(1);
}
     
static
char lbuf[X_BUF_SIZE + 1] = {""};
     
static
nntp_read_line(b,timer)
  char *b;
  int timer;
{
  char *cp, *pp;
     
  *b = '\0';
  while (strlen(b) < MAX_NNTP_SIZE) {
    if (cp = strchr(lbuf,'\n')) {
      *cp = '\0';
      strcat(b,lbuf);
      strcat(b,"\n");
      ++cp;
      pp = lbuf;
      while (*pp++ = *cp++);
      return(1);
      }
    strcat(b,lbuf);
    if (!nntp_read(lbuf,timer)) return(0);
    }
}
     
/*
 *  wait_net_response
 *
 *  Wait for a response from remote system - cmd indicates that all text
 *  should be skipped until NNTP command response is obtained
 */
     
wait_net_response(secs,cmd)
  int secs,
      cmd;
{
  if (nntp_read_line(ibuf,secs)) {
    if (!cmd) return(1);
    if (sscanf(ibuf,"%d",&cmd_code) == 1) {
      if ((cmd_code == 400) || (cmd_code == 205)) {
        close_net();
        return(0);
        }
      else return(cmd_code);
      }
    }
}
     
/* the rest of the code in this module is unaltered */
     
--
Geoff Huston
gih900@csc.anu.oz.au

Mats.Sundvall@bmc.uu.se (Mats Sundvall) (08/02/89)

In article <8908012245.AA11648@uunet.uu.net>, munnari!csc.anu.oz.au!gih900@UUNET.UU.NET (Geoff Huston) writes:
> Marc Elsen writes:
>      
>>  I just installed V58A on one of my client nodes.The conversion
>>  towards news.groups and news.items went on without any problems.
>>
>>  However it is no longer possible to read any article (resident on the
>  server).

> I got these too as soon as the local site moved to VMS V5.0 and VAX C V3.0.
>      
> SO.. I rewrote the i/o drivers in NEWSREMCLIENT.C to aviod the use of the
> SYS$HIBER and SYS$WAKE calls (there's something funny going on there) and
> rewrote it as signal and alarm calls.
>      
> Here's the modified code:

Is the corresponding code in NNTP_FEED changed as well. It may solve some
cryptict problems we have had with feeds to some machines.

This raises the question. Is it wise to have the same subroutines duplicated
in different files? When fixing one file you forget to fix the other.
We may end up with smaller code if you link NNTP_FEED and the other programs
against a common library.


-- 
		Mats Sundvall			

		Biomedical Center		+46/18174583
		University of Uppsala		Mats.Sundvall@BMC.UU.SE
		Sweden				psi%24020019700620::MATS

reggers@UWOVAX.UWO.CA (Reg Quinton) (08/02/89)

On Wed, 2 Aug 89 08:36:37 est, Geoff Huston
 <munnari!csc.anu.oz.au!gih900@UUNET.UU.NET> said:
>Here's the modified code:
>
>#module NEWSREMCLIENT "V5.9"
> .....
>/* the rest of the code in this module is unaltered */
>
     
not  quite, change every reference of  `net_write' to `nntp_write'.  (Or at
least that's what works for me)