buf[13] = 0x00;

/* send packet */

i = sendto(sock, buf, 14, 0, (struct sockaddr*)&addr, sizeof(addr));

/* receive packet */ fromlen = sizeof(addr);

len = recvfrom(sock, buf, MAXBUF, 0, (struct sockaddr*)&addr, &fromlen);

/* print receive packet */ if (len) {

if ((buf[10] == 0x00) && (buf[11] == 0x00)) for (i = 0; i < len; i++)

printf("%3d:%02Xh\n", i, buf[i] & 0xff);

}

/* close socket */ close(sock); return 0;

}

4-14Programming Samples

Rev. A

Page 72
Image 72
Epson E02 manual 14Programming Samples