Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!sun-barr!cs.utexas.edu!uunet!wugate!wupost!kuhub.cc.ukans.edu!anu-news!list From: munnari!csc.anu.oz.au!gih900@UUNET.UU.NET (Geoff Huston) Newsgroups: news.software.anu-news Subject: RE: Problems accessing server under V58A Message-ID: <8908012245.AA11648@uunet.uu.net> Date: 2 Aug 89 13:36:37 GMT Sender: ANU-NEWS Discussion Reply-To: Geoff Huston Lines: 225 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 #include #include #include #include #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