2.74
Fork of ExperimentServer by
Diff: ExperimentServer.cpp
- Revision:
- 9:5a1f3abfca66
- Parent:
- 4:434982de99ed
- Child:
- 10:47927a20c04d
--- a/ExperimentServer.cpp Thu Aug 13 20:10:30 2015 +0000 +++ b/ExperimentServer.cpp Mon Sep 14 14:28:07 2015 +0000 @@ -21,50 +21,50 @@ void ExperimentServer::init(const char * ip_addr, const char * subnet_mask, const char * gateway, unsigned int port) { if(_terminal!=NULL) { - _terminal->printf("\n==============================\nStarting Server\n"); - _terminal->printf("...Intializing Ethernet\n"); + _terminal->printf("\r\n==============================\r\nStarting Server\r\n"); + _terminal->printf("...Intializing Ethernet\r\n"); } _eth.init(ip_addr,subnet_mask,gateway); if(_terminal!=NULL) - _terminal->printf("...Connecting\n"); + _terminal->printf("...Connecting\r\n"); _eth.connect(); if(_terminal!=NULL) - _terminal->printf("...Ethernet IP Address is %s\n", _eth.getIPAddress()); + _terminal->printf("...Ethernet IP Address is %s\r\n", _eth.getIPAddress()); _server.bind(port); if(_terminal!=NULL) - _terminal->printf("...Listening on Port %d\n", port); + _terminal->printf("...Listening on Port %d\r\n", port); } int ExperimentServer::getParams(float params[], int num_params) { if(_terminal!=NULL) { - _terminal->printf("\n========================\nNew Experiment\n"); - _terminal->printf("...Waiting for parameters...\n"); + _terminal->printf("\r\n========================\r\nNew Experiment\r\n"); + _terminal->printf("...Waiting for parameters...\r\n"); } - int n = _server.receiveFrom(_client,(char *) params, sizeof(params)*sizeof(float)); + int n = _server.receiveFrom(_client,(char *) params, num_params*sizeof(float)); if ( (n% 4) > 0 ) { if(_terminal!=NULL) { - _terminal->printf("ERROR: input data bad size\n"); - _terminal->printf("ERROR: Expected %d got %d\n",4*num_params,n); + _terminal->printf("ERROR: input data bad size\r\n"); + _terminal->printf("ERROR: Expected %d got %d\r\n",4*num_params,n); } return false; } if ( n / 4 != num_params) { if(_terminal!=NULL) { - _terminal->printf("ERROR: input data bad size\n"); - _terminal->printf("ERROR: Expected %d got %d\n",4*num_params,n); + _terminal->printf("ERROR: input data bad size\r\n"); + _terminal->printf("ERROR: Expected %d got %d\r\n",4*num_params,n); } return false; } if(_terminal!=NULL) { - _terminal->printf("...Received input from: %s\n", _client.get_address()); - _terminal->printf("...Parameters: \n"); + _terminal->printf("...Received input from: %s\r\n", _client.get_address()); + _terminal->printf("...Parameters: \r\n"); for ( int j = 0 ; j < n/sizeof(float) ; j++) { - _terminal->printf(" %d) %f\n",j+1,params[j]); + _terminal->printf(" %d) %f\r\n",j+1,params[j]); } } return true;