Lpstat and tcp/ip

ITEM: RS4000014269



**************> QUESTION level 1 --> level 2 SPECIALIST <**************         
Question:                                                                       
When running lpstat to display the status of his printer queues                 
a customer complains about a too long delay when remote queues                  
don't answer.                                                                   
Is it possible to configure TCP/IP (or something else) to reduce                
the waiting period? I mean reduce the number of retries and                     
interval between them before a printer is considered down.                      
Thanks, best ragards, Marina.                                                   
************** ANSWER   level 2 -- level 1 SPECIALIST **************         
==== THIS TEXT HAS BEEN ENTERED BY IBM IN USA                                  
PMR 00085,998,758 was created on 97/02/06 at 12:56:47.                          
************** ANSWER   level 2 -- level 1 SPECIALIST **************         
==== THIS TEXT HAS BEEN ENTERED BY IBM IN USA                                  
==== ASGN: SGARDNER AT WTSCPOK  ================= DATE:970206                 
TIME:0811                                                                       
Received by Austin ITSC and assigned to AIXOPSYS.                               
                                                                                
Your question has been received and assigned to a specialist. Please            
wait for a reply. Thank you                                                     
************** ANSWER   level 2 -- level 1 SPECIALIST **************         
==== THIS TEXT HAS BEEN ENTERED BY IBM IN USA                                  
==== RESP: AIXOPSYS AT WTSCPOK  ================= DATE:970206                  
TIME:0924                                                                       
                                                                                
YOUR ITEM HAS BEEN RECEIVED.                                                    
                                                                                
************** ANSWER   level 2 -- level 1 SPECIALIST **************         
==== THIS TEXT HAS BEEN ENTERED BY IBM IN USA                                  
==== RESP: AIXOPSYS AT WTSCPOK  ================= DATE:970206                 
TIME:1559                                                                       
                                                                                
RESPONSE:                                                                       
                                                                                
When doing an lpstat on a remote queue, rembak will try to contact              
the remote host's lpd to get the status and if the server is offline            
or not running its lpd, then typically the time-out is 60 seconds.              
Though there is a -T flag on rembak (which can be added into the                
/etc/qconfig file:  backend = /usr/lpd/rembak -T ## ) the units are             
in minutes, so you can't really decrease the value.                             
                                                                                
Attached below is a small C program that checks only the status of              
the local queues - it never contacts the remote system at all.                  
Some characters may not be displayed properly or filtered out by                
reading this C source into the system.                                         
                                                                                
/*                                                                              
                                           Author:            Mark              
Lessor                                                                          
IBM Corp.                                                                       
                                                              12/21/95          
                                                                                
          A much quicker way to get lpstat info that lpstat¢                    
*/                                                                              
                                                                                
#include stdio.h                                                              
#include IN/stfile.h                                                          
#include IN/backend.h                                                         
#include sys/types.h                                                          
#include dirent.h                                                            
                                                                                
int main()                                                                      
                                                                                
         DIR              *dp;  /* The directory we want look at */             
         struct dirent  *dirp;  /* A directory entry (file)      */             
         char filename.80.;                                                     
                                                                                
   /* Open the directory with the print queue status files */                   
   if ((dp = opendir("/var/spool/lpd/stat")) == NULL)                           
       exit(1);                                                                 
                                                                                
   /* One at a time get the names of files in the status directory */           
   while ((dirp = readdir(dp)) ¢= NULL)                                         
         /* If this file name begins with s. then it's a status file */         
         if(¢strncmp("s.", dirp->d_name, 2))                                   
         {                                                                      
         sprintf(filename, "/var/spool/lpd/stat/");                             
         strcat(filename, dirp->d_name);                                        
         getstatus(filename);                                                   
  }                                                                             
                                                                                
                                                                                
int getstatus(pathname)                                                         
char *pathname;                                                                 
                                                                                
 /* File that has status for this print queue */                                
 FILE *status_file;                                                             
 char *filename;                                                                
 int n;                                                                         
                                                                               
 /* All info about a print queue status is in a stfile struct */                
 struct stfile status;                                                          
                                                                                
 status_file = fopen(pathname, "r");                                            
 if (status_file == NULL) {                                                     
    printf("Error opening status file %s\n", filename);                         
    exit(1);                                                                    
 }                                                                              
                                                                                
 /* Read sizeof(struct stfile) bytes from stat file into status */              
 n = read(fileno(status_file), (char *)&status, sizeof(struct stfile));         
                                                                                
 /* Queue status is found in byte 3 of the stfile structure                     
    This will be 1 for an enabled queue, 4 for a disabled                       
    or DOWN queue as defined in /usr/include/IN/backend.h                      
 */                                                                             
                                                                                
 filename = pathname + strlen(pathname);                                        
 while (*(filename - 3) ¢= '/')                                                 
     filename--;                                                                
                                                                                
 printf("%-30s    ", filename);                                                 
 switch (status.s_status)                                                       
   {                                                                            
     case READY:  printf("READY\n");                                            
                  break;                                                        
                                                                                
    case RUNNING: printf("RUNNING\n");                                          
                  break;                                                        
                                                                               
    case WAITING: printf("WAITING\n");                                          
                  break;                                                        
                                                                                
    case OFF:     printf("DOWN\n");                                             
                  break;                                                        
                                                                                
    default:      printf("UNKNOWN\n");                                          
                  break;                                                        
     }                                                                          
                                                                                
 Thank you for using AIX Technical Support services.                            
                                                                                
                                                                                
                                                                                
                                                                               


WWQA: ITEM: RS4000014269 ITEM: RS4000014269
Dated: 02/1997 Category: AIXCOMMS
This HTML file was generated 99/06/24~12:43:05
Comments or suggestions? Contact us