Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 9 of 29

TRAKKER Antares 246X Stationary Terminal User's Manual, pages 81 to 90

Pages 81 to 90 of 290

The original document is the PDF (2.0 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Intermec 2460 and Intermec 2461

Page 81

nugget

39 Operating the Terminal in a Network

4

The source code for the sample utilities CLIENT.CPP and the include file UTILS.H is shown on the next pages. You can build the application using Microsoft Visual C++ version 4.0 (or higher) and the Windows socket library that is included with Windows Visual C++. You can also develop your own application to meet the needs of your host environment. You run the resulting application (CLIENT.EXE) from the DOS command line. The application expects NCM to be defined as the terminal IP address in the hosts file. Once running, the application prompts you to enter a reader command, which it then sends to the 2461. The application also displays any return messages. Reader commands are handled by the 2461 terminal operating system, so you can continue running an application while you use the CLIENT.EXE application to send commands. To use the sample utility CLIENT.CPP

1. Make sure the TFTP server is running on the host and the 2461 is communicating with the host. 2. In the hosts file on the host, add the terminal IP addresses and the target name, NCM. For example, to send files or data to the 2461 with an IP address of 192.9.200.130, add this line to the hosts file: 192.9.200.130 ncm

3. Start the CLIENT.EXE application on the host. 4. When the “Enter Command” prompt appears on the host, enter the two-character TMF code, CS (Configuration Set request) followed by the reader or configuration command. For example, to send the application INVENTRY.BIN from drive C on the host to drive C on the 2461, enter this command: CS.%R,c:inventry.bin,c:inventry.bin

Or, to change the beep volume to very loud, enter this command: CS$+BV4

For command information, see Chapter 7, “Reader Command Reference” or Chapter 8, “Configuration Command Reference.”

4-23

Page 82

TRAKKER Antares 246X Stationary Terminal User’s Manual nugget

39

CLIENT.CPP Sample Application for a TCP/IP Direct Connect Network

#include <windows.h> #include <stdio.h> #include "Utils.h" // our application uses a fixed port number const unsigned short SERVER_PORT = 6000; const unsigned short CLIENT_PORT = 6001; // we will default to the local host machine // unless argv[1] has a hostname const char SERVER_HOSTNAME[] = "ncm"; int main(int argc, char *argv[]) { // turn on the socket library for this process WSADATA wsad; int error = WSAStartup(MAKEWORD(1,1), &wsad); if (error != 0) ErrorMessage("WSAStartup", WSAGetLastError()); // create an unitialized connection-oriented socket SOCKET connection; connection = socket(PF_INET, SOCK_DGRAM, 0); if (connection == INVALID_SOCKET) ErrorMessage("socket", WSAGetLastError()); // lookup the IP address of the requested host HOSTENT *phostent = gethostbyname(argc == 2 ? argv[1] : SERVER_HOSTNAME); if (phostent == 0) ErrorMessage("gethostbyname", WSAGetLastError()); // define a SOCKADDR to contain the IP address of the // server and the port number of our application SOCKADDR_IN serverAddress; memset(&serverAddress, 0, sizeof(serverAddress)); serverAddress.sin_family = PF_INET; serverAddress.sin_port = htons(SERVER_PORT); memcpy(&serverAddress.sin_addr, phostent->h_addr_list[0], phostent->h_length); // Bind a well known port of 6000 to the socket SOCKADDR_IN clientAddress; memset(&clientAddress, 0, sizeof(clientAddress)); clientAddress.sin_family = PF_INET; clientAddress.sin_port = htons(CLIENT_PORT); clientAddress.sin_addr.s_addr = htonl(INADDR_ANY); if(!(bind(connection, (LPSOCKADDR)&clientAddress, sizeof(clientAddress)) ==0)) { ErrorMessage("bind", WSAGetLastError()); }

4-24

Page 83

nugget

39 Operating the Terminal in a Network

4

CLIENT.CPP Sample Application for a TCP/IP Direct Connect Network (continued)

// attempt to connect to the server error = connect(connection, (const SOCKADDR *)&serverAddress, sizeof(serverAddress)); if (error != 0) ErrorMessage("connect", WSAGetLastError()); // check the local name for the socket SOCKADDR_IN localName; memset(&localName, 0, sizeof(localName)); int localNameLength = sizeof(localName); error = getsockname(connection, (LPSOCKADDR)&localName, &localNameLength); // run the user-interface char sz[1024]; char rz[1024]; BOOL bConnectionAlive = TRUE; printf("> "); int Scount, Rcount; int cbRecv, cbSend; Scount = Rcount = 0; int cbLen, rcLen; unsigned char *psend = (unsigned char *)sz; // continue while not EOF on the console and the connection is alive while (bConnectionAlive) { // send the string entered by the user printf("Enter Command:\n"); printf("> "); gets(sz); if(sz[0] != 'q') { cbLen = strlen(sz); cbSend = send(connection, (const char *)psend, cbLen, 0); if (cbSend < 0) { Scount++; printf("send failed %d\n", Scount); bConnectionAlive = FALSE; ErrorMessage("send", WSAGetLastError()); } Sleep(2000); // receive the converted string from the server memset(&rz, 0, sizeof(rz)); rcLen = sizeof(rz); cbRecv = recv(connection, rz, rcLen, 0); if (cbRecv < 0) {

4-25

Page 84

TRAKKER Antares 246X Stationary Terminal User’s Manual nugget

39

CLIENT.CPP Sample Application for a TCP/IP Direct Connect Network (continued)

Rcount++; printf("receive failed %d\n", Rcount); ErrorMessage("receive", WSAGetLastError()); bConnectionAlive = FALSE; } // printf the converted string printf("response:%s\n",rz); printf("\n> "); Sleep(1000); } else bConnectionAlive = FALSE; } // release the resources held by the socket error = closesocket(connection); if (error != 0) ErrorMessage("closesocket", WSAGetLastError()); // release the resources held by the socket library error = WSACleanup(); if (error != 0) ErrorMessage("WSACleanup", WSAGetLastError()); return 0; }

UTILS.H Utility (Used by CLIENT.CPP)

#include <windows.h> inline void ErrorMessage(LPCTSTR szFn, DWORD dwError = GetLastError()) { TCHAR szTitle[1024]; TCHAR szPrompt[1024]; BOOL bRet = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, dwError, 0, szPrompt, sizeof(szPrompt), 0); if (!bRet) lstrcpy(szPrompt, __TEXT("Unknown Error")); wsprintf(szTitle, __TEXT("%s failed with error code (0x%x)!"), szFn, dwError); int id = MessageBox(HWND_DESKTOP, szPrompt, szTitle, MB_ABORTRETRYIGNORE|MB_SETFOREGROUND); if (id != IDIGNORE) ExitProcess(0); }

4-26

Page 85

nugget

39 Operating the Terminal in a Network

4

About Network Connectivity and Protocols The 246X stationary terminals are data collection terminals with network support. The 2460 and 2461 communicate with a host computer or other serial device through the terminal’s serial ports. The 2461 communicates with a host directly through the Ethernet network. In a UDP Plus network, the terminal communicates through the DCS 300 to a host on an Ethernet network. In a TCP/IP network, the terminal communicates to the host on an Ethernet network. The communications protocol stack for the 246X terminal is developed using the Open Systems Interconnection (OSI) seven layer model. The illustration on the next page shows how the Ethernet network and the serial ports map into the OSI model. The terminal applications are on top of the protocol stack. Intermec provides a terminal communications API (application program interface) to interface to the protocol stack. The API provides a common interface to these Intermec value-added protocols: •

Terminal Message Format (TMF) is an Intermec proprietary protocol that is used to route data and network management messages between applications on the terminal and peer tasks on the server or host.

•

UDP Plus is an Intermec protocol built on top of the User Datagram Protocol (UDP). It maximizes the performance of Ethernet networks and provides robust data communications.

•

Trivial File Transfer Protocol (TFTP) allows efficient file exchange between the terminal and the DCS 300 or host.

•

Configurable Serial Port (CSP) protocol allows efficient file exchange between the 246X and the host through RS-232 and RS-232/422/485 (2460 only) serial communications. The terminal uses either the XMODEM or YMODEM protocol to transfer files via reader commands.

•

Network management provides network access to the terminal configuration, status, and statistics. Network management uses the Terminal Message Format to receive and send messages.

The remaining layers in the protocol stack are a series of standard protocols that interface with the drivers and hardware needed to support the Ethernet network and serial communications.

4-27

Page 86

TRAKKER Antares 246X Stationary Terminal User’s Manual nugget

39

246X Stationary Terminal Protocol Stack and the OSI Model ayers

OSI L

46X ares 2 ations applic ation nt

ER A RAKK ns additio I and P A s on unicati Comm ssage al Me Termin at (TMF) Form

T lus

UDP P l File Trivia rotocol P r fe Trans FTP) (T rk Netwo nt e m urable anage Configl port m seria col proto

Applic n ntatio

Prese n

Sessio port

Trans rk

Netwo

UDP TCP ink

P, and

IP, AR

ICMP et Ethern river ld o c to ro d et car

4-28 k etwor net N

Ether

Serial port driver Serial port p

Ethern

Data L

Wiredk r Netwo al

Physic

4

U.02

246X

Page 87

nugget

39 Operating the Terminal in a Network

4

The 246X stationary terminals use these protocols: Layer

Protocol

Description

Physical

Ethernet card

Provides Ethernet communications.

Serial port

Provides RS-232 serial communications.

Ethernet protocol driver

Provides Ethernet media access control. The default hardwired media access control (MAC) protocol used with TCP/IP supports the Ethernet II standard.

Serial port driver

Provides RS-232 (COM1) or RS-232/422/485 (COM2) serial communications control that uses CSP and the standard XMODEM or YMODEM protocol for data transfer.

IP, ARP, and ICMP

The Internet Protocol (IP) complies with the standard outlined in RFC 791.

Data Link

Network

The Address Resolution Protocol (ARP) complies with the standard outlined in RFC 826. The Internet Control Message Protocol (ICMP) complies with the standard outlined in RFC 826. Transport

Session and Presentation

UDP

The User Datagram Protocol (UDP) complies with the standard outlined in RFC 768.

TCP

Transmission Control Protocol (TCP) complies with the standard outlined in RFC 793.

UDP Plus

UDP Plus is an Intermec proprietary session layer protocol built on UDP. The UDP Plus session layer provides these services: • • • • • •

Presentation and Application guaranteed delivery duplicated message removal link connection and status management network error recovery congestion control device error detection

TFTP

Trivial File Transfer Protocol (TFTP) allows efficient file exchange between the terminal and the DCS 300 or host. TFTP complies with the standard outlined in RFC 1350.

TMF

Terminal Message Format is an Intermec proprietary protocol that is used to route data, configuration, and network management messages between applications on the terminal and peer tasks on the server or host.

4-29

Page 88

blank page

Page 89

5 Programming the Terminal

Page 90

blank page