[[TOC]] = CCommServer = CCommServer is a C++ class that is provided to simplify 825 TCP/IP server communications. CCommServer is inherited from the CComm base class. === Constructor === === Member Functions === ==== Description ==== ==== Example ==== {{{ if(commTypeSelection == SERVER) { int svrPort = 8001; CCommServer *pServer = new CCommServer(svrPort); pComm = pClient; } pComm->Open(); pComm->AddRcvEvent(CHR_STX, CHR_ETX, CommEventDataMsg, 0, NULL); } void StopCommunications(void) { if(pComm != NULL) { pComm->Close(); delete pComm; pComm = NULL; } } COMM_EVENT(DataMsg) { uint8* buf = pConnection->GetRcvBuffer(); buf[pConnection->GetRcvPos() - 1] = '\0'; printf("rcvd [%s]\r\n", buf); if(buf[1] == 'T') // Received T return timeval { time_t tmval; time(&tmval); // Get timeval char response[12]; sprintf(response, "%d\n", tmval); // pConnection isn't important in the case of serial port, but if TCP/IP server it is important to send // the response to the connection that the message was received from. pComm->Send(pConnection, response, strlen(response); } return 0; } }}} == See Also == * [wiki:CComm CComm] * [wiki:CCommClient CCommClient] * [wiki:CCommSerial CCommSerial]