EasyManuals Logo

Epson UB-E03 Technical Reference Guide

Epson UB-E03
58 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #49 background imageLoading...
Page #49 background image
Chapter 3 Programming Samples
49
3
For Linux
Theprogramisasampleofprinting“EPSONUBE03”toaTMprinterwiththeUBE03fromthe
Linuxshell,throughtheEthernetconnection.
/* TCP9100 programming sample for LINUX
* HOW TO BUILD
* cc ltcp.c
*/
#include <stdio.h>
#include <netdb.h>
int main(int argc, char* argv[])
{
int sock;
struct sockaddr_in addr;
if (argc != 2) {
printf("usage: ltcp <ip address>\n");
exit(1);
}
/* create socket */
sock = socket(AF_INET, SOCK_STREAM, 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(9100);
addr.sin_addr.s_addr = inet_addr(argv[1]);
/* connect */
if (connect(sock, (struct sockaddr*)&addr, sizeof(addr)) < 0){
perror("connect()");
}
printf("connected\n");
/* send data */
send(sock, "EPSON\n", 6, 0);
/* close socket */
close(sock);
return 0;
}

Table of Contents

Other manuals for Epson UB-E03

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Epson UB-E03 and is the answer not in the manual?

Epson UB-E03 Specifications

General IconGeneral
BrandEpson
ModelUB-E03
CategoryControl Unit
LanguageEnglish

Related product manuals