Timeout for SocketChannel doesn't work

前端 未结 3 2107
挽巷
挽巷 2020-12-03 14:38

I want to use a SocketChannel and to have a timeout for its read/write methods. I\'ve tried to set a timeout for the Socket that owns my SocketChannel

3条回答
  •  难免孤独
    2020-12-03 14:58

    You could also consider making your channel non-blockable and just using System.currentTimeMillis().

提交回复
热议问题