• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Strange nonblocking I/O, not all written data arrives on server side

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a very strange behaviour during writing to a NIO socket.
In my Android mobile client I'm using a NIO socketChannel which is configured as follows:



then periodically (every 60 seconds) I read and write some data from/to this socketChannel (the code here is a little bit simplified):




And it works. But... Sometimes (very infrequently, may 1 or 2 times per day) my server don't receive data. My client log looks like:

Written 10 bytes of 10
Written 20 bytes of 20
Written 30 bytes of 30
Written 40 bytes of 40
Written 50 bytes of 50

and so on. But on the server side it looks like:

Received 10 bytes of 10
Received 50 bytes of 50

20, 30 and 40 bytes data records were not received, despite of fact that on the client side it looks like all data was sent without any exceptions! (In reality the server log is a little bit better than this simplified version. So I can see which data was sent (my sent records contain timestamps etc))

Such gaps can be small (2-3 minutes) which is not very bad, but sometimes they can be very big (1-2 hours = 60-120 cycles) and it is really a problem for my customers.

I really have no idea what can be wrong. The data seems to be sent by client, but it never arrives on the server side. I've checked it also with a proxy.

I would be very grateful for any ideas and tips.

P.S. Maybe it plays some role: the client code runs on an Android mobile device which is moving (it is in a car). The internet connection is established through GPRS.

 
Valeri Kalaschnikow
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The frustrating is that I can't reproduce it immediately. It is necessary to wait a couple of hours until such an error occurs. And on the client side I don't know when this error occurs. The data seems to be sent! But on the server side it never arrives.
 
reply
    Bookmark Topic Watch Topic
  • New Topic