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).