beautypg.com

5 get echo – INFICON XTC/3 Thin Film Deposition Controller Communications Library Operating Manual User Manual

Page 27

background image

1 - 13

IP

N 07

4-

45

4-

P1

B

XTC/3 Communications Library Operating Manual

1.3.2.5 get Echo

int getEcho (XTC3String *val, char* ErrMsg, unsigned short *len, BOOL TCP);

Description

This function is used to test the quality of communication by sending a string of
at most 16 characters and receiving back the same string.

Arguments

XTC3String *val:

Holds the echo string

char* ErrMsg

unsigned short *len

BOOL TCP

Example

#include "XTC3Lib.h"
void main()
{

if(StartSocket()==0)

printf("Socket could not be initialized.");

if(!ConnectSocket("10.211.70.209"))

printf("Socket could not be connected!");

char ErrStr[256];
memset(ErrStr,0,256);
XTC3String str;
strcpy((char*)str.m_Data,"Are you there?");
unsigned short length = strlen((const char*)(str.m_Data))+1;
BOOL TCP = TRUE; // TCP/IP comm
getEcho(&str, ErrStr, &length, TCP);
if(*ErrStr == 0)
{

printf("Data Transfer successful\n");
printf("The returned string is %s\n",str.m_Data);

}
else

printf(ErrStr);

CloseSocket();

}