2

According to this post, UDP just doesn't block. Are there any advantage using the (non-blocking) NIO API for UDP? Or should I just use the easier "traditional" io API?

2 Answers 2

2

At the risk of just pointing you back, the comments to that post explain that UDP doesn't block on the TCP ACK, but you could still block on a kernel buffer overflow. This would happen only if you have a very big UDP burst.

1
  • 5
    Obviously nothing, that is exactly why you don't wait for TCP ACK.
    – MSalters
    Nov 13, 2009 at 9:14
0

If you are working with a large number of streams, it may help you to have a dedicate threading model to handle those sockets. NIO provides some of the work (selectors) that would help.

2
  • can NIO be used to listen to UDP broadcast from a server to an android phone. Is there any problem if i constantly receive and listen to UDP signals using the traditional way in android, because in my case after working for long time its not listening to packets. Sep 2, 2016 at 4:27
  • I haven't, but this post (read all responses) indicates it can be: stackoverflow.com/questions/17472781/java-nio-udp-broadcast
    – Jim Rush
    Sep 2, 2016 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.