I communicate with my device over wifi. I need send from ever 20ms some bytes to my device. But I cannot send data more quickly like 100ms! When I use timer with 20ms period, system will send data in 100ms together. Setting timer to 200ms works, data sent ever 200ms. But In decreasing period to 20ms.
This is part of code:
// initialization of socket:
SocketAddress sockaddr = new InetSocketAddress(ip, parseInt(prt));
nsocket = new Socket();
// this is from timer, run every 20ms
nos = nsocket.getOutputStream();
But android will send it with 100ms period! and together all bytes from every 30ms period of my timer
I think, it causes naggle algorithm. It's possible to switch it off. I found in documentation somethink about TCP_NODELAY, how can I use it? Is there any way how to send data to socket from android immediatelly?