c# - minimizing the connection cost of a rest web service -


i connecting iis 7 rest web server , sending gps readings. save reading every 20 seconds submit web service every 60 seconds.

here connection:

    var readings = reading.getunprocessreadings().tolist();      var gpsreadings = new list<truckgpsreading>();      history.history = "truckgpsreading count: " + readings.count();      var count = 1;     while (readings.any())     {       {         gpsreadings = new list<truckgpsreading>();         if (readings.any())         {           history.history = "no. transactions process: " + count;           foreach (var reading in readings)           {             history.history = "currently reading #" + count;             history.history = "processing reading: " + reading.datetimeofreading;             logging.log("starting processgpsfile.processreading 3", "processreading", apps.remotetruckservice);             var gpsreading = new truckgpsreading();             gpsreading.datetimeofreading = reading.datetimeofreading;             gpsreading.direction = reading.direction;             gpsreading.drivernumber = currentinisettings.drivernumber;             gpsreading.gpsreadingid = reading.readingid;             gpsreading.latitude = (float) reading.latitude;             gpsreading.longitude = (float) reading.longitude;             gpsreading.speed = reading.speed;                             gpsreading.trucknumber = string.isnullorwhitespace(currentinisettings.trucknumber) ? "99" : currentinisettings.trucknumber;             gpsreadings.add(gpsreading);             totalreadings++;             count++;           }            var response = client.savegpsreadings(globalsetting.tokenid, globalsetting.sourceid, gpsreadings.toarray());           if (response != "true")           {             history.history = "transactions not saved: " + response;             logging.log("processgpsfile.processreading: " + response, "processreading", apps.remotetruckservice);           }           else           {             history.history = "transactions saved.";             logging.log("processgpsfile.processreading: reading.deletegpsreadings(readings)", "processreading",                         apps.remotetruckservice);             reading.deletegpsreadings(readings);           }         } 

and truckgpsreading:

  [datacontract]   public class truckgpsreading   {     [datamember]     public string drivernumber { get; set; }      [datamember]     public string trucknumber { get; set; }      [datamember]     public float latitude { get; set; }      [datamember]     public float longitude { get; set; }      [datamember]     public datetime datetimeofreading { get; set; }      [datamember]     public int speed { get; set; }      [datamember]     public string direction { get; set; }      [datamember]     public int odometerreading { get; set; }      [datamember]     public guid gpsreadingid { get; set; }     } 

i finding amount of information being sent approx 256 bytes each record seems connection in 30k area. i'm not sure causes or if there better way around this.

my problem when data sent up, going on cell network. these networks limited on monthly data usage , i'm trying minimize usage.

if connect the service when application opens , stay connected, bad idea? thinking connect when application starts , have 1 time connection cost instead of connecting every time go send. edit wanted add program run on daily basis 8 10 hours.

also, there way cut down on connection costs or find out doing when connected?

i know lot of questions i'm new web services.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -