EasyManua.ls Logo

Epson UB-E02 - Page 71

Epson UB-E02
86 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Rev. A 4-13 Programming Samples
UB-E02 Technical Reference Guide
4.7.8.2 For Linux
/* UDP3289 programming sample for LINUX
* HOW TO BUILD
* cc ludp.c
*/
#include <stdio.h>
#include <netdb.h>
#define MAXBUF 512
char buf[MAXBUF];
int main(int argc, char* argv[])
{
int sock;
struct sockaddr_in addr;
int i, len;
socklen_t fromlen;
if (argc != 2) {
printf("usage: udp3289 IP_ADDRESS\n");
exit(1);
}
/* create sockets */
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
perror("socket()");
exit(1);
}
/* initialize the parameter */
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(3289);
addr.sin_addr.s_addr = inet_addr(argv[1]);
/* make a packet (PRINTER STATUS) */
buf[0] = 'E';
buf[1] = 'P';
buf[2] = 'S';
buf[3] = 'O';
buf[4] = 'N';
buf[5] = 'Q'; // PacketType (Q)
buf[6] = 0x03; // DeviceType(3)
buf[7] = 0x00; // DeviceNumber(0)
buf[8] = 0x00; // Function(0010h)
buf[9] = 0x10;
buf[10] = 0x00; // Result
buf[11] = 0x00;
buf[12] = 0x00; // parameter length Length

Table of Contents

Other manuals for Epson UB-E02

Related product manuals