Changes between Version 2 and Version 3 of Docs/Prog/Manual/ApplicationLibraries/lib825ev/ccomm


Ignore:
Timestamp:
04/09/18 09:08:29 (7 years ago)
Author:
Don Wilson
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Docs/Prog/Manual/ApplicationLibraries/lib825ev/ccomm

    v2 v3  
    1313#define SERIAL 1
    1414#define CLIENT 2
     15#define SERVER 3
    1516
    1617int commTypeSelection = CLIENT;
     
    3031      CCommClient *pClient = new CCommClient(svrIP, svrPort);
    3132      pComm = pClient;
     33   }
     34   else if(commTypeSelection == SERVER)
     35   {
     36      int svrPort = 8001;
     37      CCommServer *pServer = new CCommServer(svrPort);
     38      pComm = pServer;
    3239   }
    3340
     
    5764   printf("rcvd [%s]\r\n", buf);
    5865
     66   if(buf[1] == 'T') // Received <STX>T<ETX> return timeval
     67   {
     68       time_t tmval;
     69       time(&tmval);  // Get timeval
     70
     71       char response[12];
     72       sprintf(response, "%d\n", tmval);
     73       pComm->Send(pConnection, response, strlen(response);
     74    }
     75
     76
    5977   return 0;
    6078}