|
Well, the characteristic you desire would be SIGNAL CHECK, at
least on most Decservers. I didn't see that available in the
RP200 manual, nor did I find anything similar for that product.
For serial printers, many other Decservers would do IP and
Signal Check. If they need parallel, and/or IP and Signal Check
ability, that may be a problem......
DAP
|
| I finaly managed to have a RapidPrint 200 and I've done some testings.
It doesn't work.
I configured I printer on the parallel port, I run the customer program
that opens the socket and send the data and with the printer on
everything works fine, it work fine also if the printer is off-line,
but it fails if the printer is off. Following you'll find all the
details.
Unix 4.0
RapidPrint 200 ROM 1.17
DecWrite 95
nicprint.conf
#Description Parameter
#_________________________________________
Internet-Address 16.192.16.162
Netmask 255.255.255.0
Forwarding N
Base-Port-Number 10000
Keepalive Y
Max-Transmission-Unit 1500
Broadcast 0
SNMP-System-Description Network printer
SNMP-System-ID 1.3.6.1.4.1.24
Ethernet Y
Default-Router-IP 16.192.16.116
Serial-Direction OUT
Serial-Baud-Rate 19200
Serial-Data-Bits 8
Serial-Stop-Bits-Fixed 1
Serial-Parity None
Serial-DTR/DSR Enabled
Serial-XOn/XOff Enabled
Novell-Protocol Y
Apple-Protocol Y
Banners-ON/OFF OFF
Parallel-port1-data-format ASCII
Serial-port2-data-format ASCII
Parallel-port-data-format UNUSED
Parallel-port-data-format UNUSED
LAT-Protocol Y
Powerup-Status-Page ON
#
In the next reply you'll find the c program.
Log:
------> printer on-line
OPALE:gea:/usr/users/gea/linguaggi/c> ./sockprint rapidp
IP address 0x10c010a2
Send on socket 3 the message prova di stampa tramite printer server
PRINTER DEC 200
of lenght 57 bytes
Sended request return value 0
------> printer off-line
OPALE:gea:/usr/users/gea/linguaggi/c> ./sockprint rapidp
IP address 0x10c010a2
Timeout
Connection refused, retry !!!
Connection refused, retry !!!
Connection refused, retry !!!
Connection refused, retry !!!
Connection refused, retry !!!
Connection refused, retry !!!
Connection refused, retry !!!
Connection refused, retry !!!
Connection refused, retry !!!
Connection refused
------> printer turned off
OPALE:gea:/usr/users/gea/linguaggi/c> ./sockprint rapidp
IP address 0x10c010a2
Send on socket 3 the message prova di stampa tramite printer server
PRINTER DEC 200
of lenght 57 bytes
Sended request return value 0
THIS IS THE PROBLEM !
On the parallel port there should be no concern about signaling like
data set ready or similar.
Any idea is wellcome since this problem is critical for the customer,
the allert messages of his applications are printed and he would like
to have notifications when the printer is off.
Thanks again,
Gea
|
| /* compilazione: cc prova.c -o prova */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include "recognize.h"
char *hostname;
char outdata[50];
int sock;
/* argomento nome del printer server collegato in rete */
main(argc, argv)
int argc;
char **argv;
{
struct servent *sp;
struct sockaddr_in server;
struct hostent *hp, *gethostbyname();
unsigned int ip_addr;
int ok, loops, str_len;
char ack;
hostname = argv[1];
hp = gethostbyname(hostname);
if (hp ==0){
(void) fprintf(stderr,"%s: unknown host\n", hostname);
exit(errno);
}
ip_addr = *(int*) hp-> h_addr;
(void) fprintf(stderr,"IP address 0x%x\n", htonl(ip_addr));
memset((char *)&server, 0, sizeof(server));
server.sin_family = AF_INET;
server.sin_port = htons(10001);
server.sin_addr.s_addr = ip_addr;
ok = 0;
loops = 0;
do{
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0){
(void) fprintf(stderr,"Error creating socket\n");
exit(errno);
}
if (connect(sock, (struct sockaddr *) & server, sizeof server) < 0){
loops++;
if (errno == ECONNREFUSED){
(void) fprintf(stderr,"Connection refused, retry !!!\n");
close(sock);
sleep(5);
}else{
if (errno == ETIMEDOUT){
(void) fprintf(stderr,"Timeout\n");
close(sock);
}else{
(void) fprintf(stderr,"Unable to contact lpd daemon %d\n", errno);
exit(errno);
}
}
}else{
ok++;
}
}while (!ok && loops < 10);
if (!ok){
(void) fprintf(stderr,"Connection refused\n");
exit(errno);
}
strcpy(&outdata[0], "prova di stampa tramite printer server PRINTER DEC 200 \r\n");
str_len = strlen(outdata);
fprintf(stderr,"Send on socket %d the message %s of lenght %d bytes\n", sock, outdata, str_len);
if (ok = send((int)sock, outdata, (unsigned)str_len, 0) < 0)
{
(void) fprintf(stderr, "Error writing header to socket\n");
close(sock);
exit(errno);
}
(void) fprintf(stderr, "Sended request return value %d\n", ok);
#ifdef COMPILE
if (read(sock, &ack, sizeof(ack)) < 0)
{
(void) fprintf(stderr, "Error reading answer from socket\n");
close(sock);
exit(errno);
}
(void) fprintf(stderr,"Receive from socket %d the message %s\n", sock, ack);
if(atoi(ack) == 0)
(void) fprintf(stderr,"Error on server end\n");
if(atoi(ack) == 1)
(void) fprintf(stderr,"Successfully\n");
else
(void) fprintf(stderr,"Error reading acknowledgment from server\n");
#endif
/* finche' non si chiude la connessione non effettua la stampa, PROBLEMA !!!! */
close(sock);
}
|