Epson E02 manual Direct Printing by PORT9100, For Windows Console

Page 61

UB-E02 Technical Reference Guide

4.2 Direct Printing by PORT9100

4.2.1 For Windows Console

The program is a sample of printing “EPSON UB-E02” to a TM printer with the UB-E02 from the Windows shell, through the ethernet connection.

/* TCP9100 programming sample for win32

*HOW TO BUILD

*cl wtcp.cpp wsock32.lib

*/

#include <stdio.h> #include <winsock.h>

int main(int argc, char* argv[])

{

WSADATA data; SOCKET sock; struct linger Linger; struct sockaddr_in addr;

if (argc != 2) {

printf("usage: wtcp <IP address>\n"); exit(1);

}

/* Initialize windows socket */ WSAStartup(0x0101, &data);

/* Create socket */

if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) { fprintf(stderr, "Error socket(): %d\n", WSAGetLastError());

exit(1);

}

/* Set connection timeout */ Linger.l_onoff = 1; Linger.l_linger = 60;

setsockopt(sock, SOL_SOCKET, SO_LINGER, (char*)&Linger, sizeof(struct linger));

/* 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) { fprintf(stderr, "Error connect(): %d\n", WSAGetLastError()); exit(1);

}

printf("connected\n");

Rev. A

4-3Programming Samples

Image 61
Contents UB-E02 Technical Reference Guide Page Rev. a Revision Information About This Guide Contents of the GuideRelated Documents CE Marking EMC and Safety Standards AppliedFCC Compliance Statement For American Users For Canadian UsersGereäuschpegel Key to SymbolsProduct Servicing Safety PrecautionsLabel Introduction Environments for Setup UtilityOperating Environments Supported Operating SystemsSupported TM Printers Installation Overview How to Use this GuideProgramming AppendixContents Rev. a Contents Xii Contents Rev. a Supported Network Protocols Supported Operating SystemsOther Limitations Installation Precautions InstallationUnpacking SwitchPart Names FunctionsUB-E02 Installation 4Installation Rev. a Page 6Installation Rev. a UB-E02 Status Sheet Printing Initializing UB-E022 Q2. The self test does not operate correctly FAQ3 Q3. Starting up the printer takes a long time UB-E02 Technical Reference Guide 10Installation Rev. a Setting the IP Address using Epson TMNet WinConfig Setting the IP AddressSetting the TCP/IP protocol in Your Operating System Windows UB-E02 Technical Reference Guide Windows NT Windows Installation Environments Installing Epson TMNet WinConfigInstallation with Windows Setting with the Epson TMNet WinConfig UB-E02 Technical Reference Guide Page Setting the IP Address Using the arp/ping Command Example ping Epson TMNet WinConfig Functions Menu Bar Tool Menu Time-out settingSearch Options Settings Printer Print server TCP/IP Password Opening Screen Epson TMNet WebConfig FunctionsTCP/IP General Information Protocol Information and SettingsApipa 2.2 TCP/IP InformationSnmp Information 2.4 TCP/IP Setting Snmp Communication Setting Snmp IP Trap 1 Setting Snmp IP Trap 2 Setting Administrator Setting Password Setting Reset Advanced Programming Samples Buffer of the UB-E02 Method of Printing to the UB-E02For Windows Console Direct Printing by PORT91004Programming Samples For Linux Monitoring of the ASB status Commands Sent to a TM Printer When the Power is OnPriorities of Printing Time-out for ConnectionCommands Packets Printer Operation by the UDP Commands3 03-0010 Retrieving Status 2 03-0000 Retrieving Basic InformationReply data 4 03-0011 Forced Transmission 5 03-0012 ResetSet-up data 6 03-0013 Buffer Flash 7 03-0016 Clearing Connection Time-Out TimerFor Windows Console Programming Sample12Programming Samples Rev. a 13Programming Samples For Linux14Programming Samples Printer Connection FeaturesLine Display Connection OverviewHardware Specifications External appearance and connector locations Software SpecificationsBasic Communications Protocols Printing Communications ProtocolsHttp Status Inquiry and Setting ProtocolsSnmp MIB Enpc Automatic IP Address Assignment ProtocolsIP Address Acquisition by Dhcp IP Address Assignment by Apipa Manual SettingItem List Internal SettingsSetting with Exclusive utility Internal Parameter Setting MethodsSetting with Browser Setting the IP Address with arp + pingInitializing Upgrade MethodsVersion Upgrading Supported protocolStorage Conditions Environmental SpecificationsDefinitions 2Definitions Rev. a Page Epson