Intermec Trakker Antares 2460 User Manual page 83

Trakker antares 246 series stationary terminal
Hide thumbs Also See for Trakker Antares 2460:
Table of Contents

Advertisement

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)
{
}
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)
{
nugget
Scount++;
printf("send failed %d\n", Scount);
bConnectionAlive = FALSE;
ErrorMessage("send", WSAGetLastError());
39
Operating the Terminal in a Network
4
4-25

Advertisement

Table of Contents
loading

This manual is also suitable for:

Trakker antares 2461

Table of Contents