Read Failed at cupsBackChannelRead
Michael Sweet
msweet at apple.com
Mon Nov 16 08:36:02 PST 2009
If you use stdio you need to fflush(stdout) to force the data to the backend, and then you do NOT want to have a timeout of 0.0 when calling cupsBackChannelRead - use at least 10 seconds to allow for interface/network delays.
For synchronized queries, you probably also want to use cupsSideChannelDoRequest() to tell the backend to drain all pending output before reading the data back, e.g.:
fputs("something", stdout);
fflush(stdout);
char buff[256];
int bufflen = 0;
cupsSideChannelDoRequest(CUPS_SC_CMD_DRAIN_OUTPUT, buff, &bufflen, 10.0);
bufflen = (int)cupsBackChannelRead(buff, sizeof(buff), 10.0);
On Nov 16, 2009, at 12:57 AM, Zebra wrote:
> Hi,
>
>
> I written following code to read the printer response,
>
> char buff[256] = {0};
> memset(buff,0,sizeof(buff));
> fputs("\033!RIBLEN\r",stdout);
>
> memset(buff,0,sizeof(buff));
> fputs("\033E 2\r",stdout);
> fputs("\033V\r",stdout);
>
> memset(buff,0,sizeof(buff));
> ssize_t retv=cupsBackChannelRead(buff,sizeof(buff),0.0);
>
> Finaly buff contains nothing and return value also -1.pls point out where is error.
>
>
> Thanking You
> _______________________________________________
> cups-ddk mailing list
> cups-ddk at easysw.com
> http://lists.easysw.com/mailman/listinfo/cups-ddk
___________________________________________________
Michael Sweet, Senior Printing System Engineer
More information about the cups-devel
mailing list