nugget
39
Operating the Terminal in a Network
4-25
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)
{
+;
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)
{
Содержание Trakker Antares 2460
Страница 1: ...Trakker Antares 246X Stationary Terminal User s Manual...
Страница 4: ...blank page...
Страница 19: ...Introducing the 246X Stationary Terminal 1...
Страница 20: ...blank page...
Страница 29: ...Installing the Terminal 2...
Страница 30: ...blank page...
Страница 47: ...Configuring the Terminal 3...
Страница 48: ...blank page...
Страница 58: ...blank page...
Страница 59: ...Operating the Terminal in a Network 4...
Страница 60: ...blank page...
Страница 88: ...blank page...
Страница 89: ...Programming the Terminal 5...
Страница 90: ...blank page...
Страница 107: ...Troubleshooting 6...
Страница 108: ...blank page...
Страница 121: ...Reader Command Reference 7...
Страница 122: ...blank page...
Страница 149: ...Configuration Command Reference 8...
Страница 150: ...blank page blank page...
Страница 242: ...blank page blank page...
Страница 243: ...Specifications A...
Страница 244: ...blank page blank page...
Страница 257: ...Full ASCII Charts B...
Страница 258: ...blank page blank page...
Страница 267: ...Using the Default Applications C...
Страница 268: ...blank page blank page...
Страница 279: ...Index I...
Страница 280: ...blank page...
Страница 290: ...body text 4...