//-------- default timeout -----
int iConnectionTimeout=2000;
int iSendTimeout=2000;
int iReceiveTimeout=2000;
int main(int argc, char **argv)
{
int i,j;
SOCKET conn_socket;
int iRetVal,iVersion;
WORD wStartAddress=1;
WORD wCount=16;
WORD wData[16];
char line[80];
printf("In this demo, the IP Address of 6000 module is assumed as 172.16.2.200\n");
printf("Please make sure the IP Address for your 6000 module is 172.16.2.200 (Y/N)? ");
gets(line);
if( toupper( line[0])!='Y' )
return 0;
for(i=0; i<wCount; i++)
wData[i]=0xffff;
iVersion=ADAMTCP_GetDLLVersion();
printf("The Version=%04x\n",iVersion);
//--- Firstly, try to create a connection to ADAM-6000 ---
//--- Please change the following IP address to match your ADAM-6000 module ---
iRetVal=ADAMTCP_Connect(SOCK_STREAM,"172.16.2.200",502,&conn_socket,
iConnectionTimeout, iSendTimeout, iReceiveTimeout);
if( iRetVal<0 )
{
printf("Connect Failure !!! code=%d\n",iRetVal);
exit(0);
}