Вопрос

I'm trying to harden a java-websocket server against DoS attacks by limiting incoming message size.

I found this great Q&A on C sockets' receive buffers (which I presume is the way to limit size since I cannot find anything else). In it, it says that there are two types of sockets: datagram and streaming.

The answer says that datagram sockets simply cut off any excess bytes which is just fine for my purposes since an incomplete message is incorrect and will cause the sender to be blacklisted.

I'm now trying to determine if WebSockets are datagram or streaming. It seems like they're datagram since they use "frames", but I have no idea. Is that correct?

If they can be streaming, how can java-websocket, client & server, be configured to use datagram, if that's even appropriate? Is it possible to detect an excessively large message with datagram?

If streaming is more appropriate, how can excessively large messages be detected?

Это было полезно?

Решение

check this question, it looks like is not possible to use datagram with the current websocket spec.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top