Intermec Trakker Antares 2410 System Manual page 47

Intermec trakker antares 2410: user guide
Hide thumbs Also See for Trakker Antares 2410:
Table of Contents

Advertisement

serverAddress.sin_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());
}
// 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)
{
}
Trakker Antares 2400 Family System Manual
= htons(SERVER_PORT);
Scount++;
printf("send failed %d\n", Scount);
bConnectionAlive = FALSE;
ErrorMessage("send", WSAGetLastError());
Chapter 2—Configuring and Managing the Terminals
27

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents