The text of a manual · part 31 of 64
Trakker Antares 24XX Terminal User's Manual Addendum, with the Trakker Antares 2420 and 2425 Hand-Held Terminal User's Manual: Chapter 4 - Operating the Terminal in a Network, pages 243 to 250
Pages 243 to 250 of 558, from Trakker Antares 24XX Terminal User's Manual Addendum, with the Trakker Antares 2420 and 2425 Hand-Held Terminal User's Manual
The original document is the PDF (4.1 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 2420 and Intermec 2425
Page 243
Co de
39 Nugget Operating the Terminal in a Network
4
Transferring Files in a TCP/IP Direct Connect Network You can use an application on the host computer to transfer files and send data between the terminal and host in a TCP/IP direct connect network. To initiate file transfers from the host, you need to write a host application that can communicate directly with a T2425. You use the file management reader commands such as Receive File and Transmit File to transfer files between the T2425 and the host. For help, see Chapter 8, “Reader Command Reference.” To initiate file transfers from the terminal, you do not need to develop a host application as described in this section. You can use the Receive File and Transmit File within a terminal application or by scanning bar code labels. For help, see Chapter 8, “Reader Command Reference.” Note: You can continue running an application on the T2425 while configuring the terminal or transferring files from the host. To use the built-in TFTP client on the T2425, you need the following: •
TFTP (Trivial File Transfer Protocol) server must be running on the host.
•
TFTP server must be running on at least a Pentium processor or equivalent.
•
T2425 must be communicating with the host that is running the TFTP server.
•
The TFTP server or some other application on the host must be able to send the reader command on the network.
To transfer files or send configuration data from the host 1. Make sure the TFTP server is running on the host and the T2425 is communicating with the host. 2. Start the host application that can send reader commands to the terminal. 3. Send the two-character TMF code, CS (Configuration Set request) followed by the reader or configuration command. For help on TMF, see “Configuring the T2425 in a TCP/IP Direct Connect Network” earlier in this chapter. For example, to send the application INVENTRY.BIN from drive C on the host to drive C on the T2425, enter this command: CS.%R,c:inventry.bin,c:inventry.bin
For command information, see Chapter 8, “Reader Command Reference.”
4-31
Page 244
TRAKKER Antares 2420 and 2425 Hand-Held Terminal User’s Manual Co de
39 Nugget
CLIENT.CPP is the source for a sample application you can run on the host. You can use CLIENT.CPP to send reader commands to the T2425 and receive the resulting messages.
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 sockets library that is included with Microsoft 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 TRAKKER Antares terminal IP address in the hosts file. Once running, the application prompts you to enter a reader command, which it then sends to the T2425. The application also displays any return messages. Reader commands are handled by the TRAKKER Antares operating system, so you can continue running an application while you use the CLIENT.EXE application to send commands.
4-32
Page 245
Co de
39 Nugget Operating the Terminal in a Network
4
CLIENT.CPP Sample Application for a TCP/IP Direct Connect Network #include <windows.h> #include <stdio.h> #include "d:\class\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-33
Page 246
TRAKKER Antares 2420 and 2425 Hand-Held Terminal User’s Manual Co de
39 Nugget
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-34
Page 247
Co de
39 Nugget Operating the Terminal in a Network
4
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-35
Page 248
TRAKKER Antares 2420 and 2425 Hand-Held Terminal User’s Manual Co de
39 Nugget
About Network Connectivity and Protocols The T2420 and T2425 are hand-held data collection terminals with network support. The terminals communicate with a host computer or other serial device through the terminal’s RS-232 serial port. The T2425 also communicates with a host either through the DCS 300 or directly through the access points. The access point acts as a bridge between the Ethernet or token ring network and the RF network. In a UDP Plus network, the terminal communicates through the DCS 300 to a host on an Ethernet, token ring, twinaxial, coaxial, or SDLC network. In a TCP/IP network, the terminal communicates through the access point to the host on an Ethernet or token ring network. The communications protocol stack for the terminal is developed using the Open Systems Interconnection (OSI) seven layer model. The illustration on the next page shows how the 2.4 GHz RF network and RS-232 serial port map into the OSI model. The terminal applications including terminal emulation and screen mapping 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 DCS 300 or host.
•
UDP Plus is an Intermec protocol built on top of the User Datagram Protocol (UDP). It maximizes the performance of wireless (RF) and hardwired 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 terminal and the host through RS-232 serial communications. The terminal uses either the XMODEM or the 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 2.4 GHz RF network and RS-232 serial communications.
4-36
Page 249
Co de
4
39 Nugget Operating the Terminal in a Network
TRAKKER Antares Terminal Protocol Stack and the OSI Model ayers
OSI L 2420 tares ns n A R atio KE TRAK 425 applic and 2 ns additio I and P A s on unicati Comm ssage al Me Termin at (TMF) Form l File Trivia fer s Tran ol Protoc ) (TFTP lus
UDP P rk Netwo nt e m urable anage Configl port m seria col proto
UDP TCP IP
RP and A
ICMP river col d F proto
Hz R
2.4 G io
Hz rad
2.4 G twork
RF Ne
4-37 ation
Applic n ntatio
Prese n
Sessio port
Trans rk
Netwo ink
Data L Serial port driver Serial port Wiredk r Netwo al
Physic
0
U.09
242X
Page 250
TRAKKER Antares 2420 and 2425 Hand-Held Terminal User’s Manual Co de
39 Nugget
The terminals use these protocols: Layer
Protocol
Description
Physical
2.4 GHz radio
Provides spread spectrum radio signal control.
Serial Port
Provides serial communications.
2.4 GHz RF protocol driver
Provides RF media access control. The default hardwired media access control (MAC) protocol used with TCP/IP supports the Ethernet II standard.
Serial port driver
Provides serial communications control that uses CSP and the standard XMODEM or the YMODEM protocol for data transfer.
IP and ARP
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.
Transport
Session and Presentation
ICMP
The Internet Control Message Protocol (ICMP) complies with the standard outlined in RFC 826.
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
4-38 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 DCS 300 or host.