Avoid denial of service attacks

When I use recv from window sockets, can using recv lead to a denial of service attack? If he is waiting for data forever? So what is the best way to solve this problem (alarms?)

Thanks and respect,

mouse.

+5
source share
3 answers

You seem to misunderstand what denial of service means. An example is a large number of HTTP requests to a single web server, so fast that the web server software becomes so busy that it cannot accept new TCP connections. Wikipedia has a decent article on DoS , read it.

recv(2)is just an API. Misuse, like any other mistake, can lead to problems, including DoS. But this does not mean that you should avoid it. If your problem blocks other sockets while waiting to be read, look at non-blocking sockets and I / O multiplexing , as in select(2), poll(2)and epoll(4).

+3

, recv() . - -.

boost asio library. , , . , , .

DoS-, -. , - .

+1

, - send() recv() SO_SNDTIMEO SO_RCVTIMEO setsockopt(),

, , , . .

, ( ), , 2 4 , , . , , .

+1

All Articles