D*********s 发帖数: 555 | 1 有没有可能non-blocking socket和Stream一起用呢?
还有UDP可以用Stream么? | f*****g 发帖数: 31 | 2
Yes you can. But it is better using nio. The best, it is
still use tradition Java socket. NB Socket's performance
is too bad.
【在 D*********s 的大作中提到】 : 有没有可能non-blocking socket和Stream一起用呢? : 还有UDP可以用Stream么?
| D*********s 发帖数: 555 | 3 Where did you get the data saying that NB Socket's performance
is bad? any link please.
You said I can use non-blocking socket along with Stream. Can you
please tell some details?
As I know if you don't use nio, which has select(), you actually
can't use non-blocking socket because busy waiting is a BAD idea.
Did you just refer to this busy waiting when you said NB socket's
performance?
【在 f*****g 的大作中提到】 : : Yes you can. But it is better using nio. The best, it is : still use tradition Java socket. NB Socket's performance : is too bad.
| e***g 发帖数: 158 | 4 short answer: no. no such API/adapter.
middle answer: don't use socket channel, mostly you don't need it,
it just makes your program complicated without visible performance
gain. keep code simple and scalable, put more servers, it's cheap.
long answer: if you do reach some kind of limit and you must use
socket channel. sure you can write your own plumbing and make
adapters of channel->stream, but then you end up with thousands
of threads and defeat the purpose of select(). in this
【在 D*********s 的大作中提到】 : Where did you get the data saying that NB Socket's performance : is bad? any link please. : You said I can use non-blocking socket along with Stream. Can you : please tell some details? : As I know if you don't use nio, which has select(), you actually : can't use non-blocking socket because busy waiting is a BAD idea. : Did you just refer to this busy waiting when you said NB socket's : performance?
| D*********s 发帖数: 555 | 5 This makes sense. Thanks.
【在 e***g 的大作中提到】 : short answer: no. no such API/adapter. : middle answer: don't use socket channel, mostly you don't need it, : it just makes your program complicated without visible performance : gain. keep code simple and scalable, put more servers, it's cheap. : long answer: if you do reach some kind of limit and you must use : socket channel. sure you can write your own plumbing and make : adapters of channel->stream, but then you end up with thousands : of threads and defeat the purpose of select(). in this
|
|