tcp echo/query test setup

This commit is contained in:
Erwin Coumans
2017-02-20 09:34:00 -08:00
parent 3e94840340
commit 970de9c4d7
2 changed files with 37 additions and 17 deletions

View File

@@ -19,7 +19,7 @@ int main(int argc, char **argv)
// and received.
//--------------------------------------------------------------------------
// if (socket.Open("time-C.timefreq.bldrdoc.gov", 13))
if (socket.Open("127.0.0.1", 6789))
if (socket.Open("localhost", 6667))
{
//----------------------------------------------------------------------
// Send a requtest the server requesting the current time.
@@ -34,10 +34,13 @@ int main(int argc, char **argv)
//----------------------------------------------------------------------
// Receive response from the server.
//----------------------------------------------------------------------
socket.Receive(len);
uint8* data = socket.GetData();
memcpy(&time, data, len);
printf("%s\n", time);
int rec = socket.Receive(len);
if (rec)
{
uint8* data = socket.GetData();
memcpy(&time, data, len);
printf("%s\n", time);
}
//----------------------------------------------------------------------
// Close the connection.